[gnue] r9915 - trunk/gnue-common/src/formatting

[email protected]
Newsgroups gmane.comp.cms.gnue.cvs
Message-ID <[email protected]>
Author: reinhard
Date: 2009-08-11 03:51:27 -0500 (Tue, 11 Aug 2009)
New Revision: 9915

Modified:
   trunk/gnue-common/src/formatting/GDataFormatter.py
Log:
Also check for decimal.Decimal type. Thanks to John Proios.


Modified: trunk/gnue-common/src/formatting/GDataFormatter.py
===================================================================
--- trunk/gnue-common/src/formatting/GDataFormatter.py	2009-04-03 10:19:49 UTC (rev 9914)
+++ trunk/gnue-common/src/formatting/GDataFormatter.py	2009-08-11 08:51:27 UTC (rev 9915)
@@ -30,6 +30,7 @@
 #
 
 from types import *
+import decimal
 from gnue.common.external.fixedpoint import FixedPoint, addHalfAndChop
 FixedPoint.round = addHalfAndChop
 
@@ -49,7 +50,7 @@
       pass
 
     # TODO: As said above, this is a bad hack w/a lot of assumptions
-    if type(value) == FloatType:
+    if type(value) == FloatType or isinstance(value, decimal.Decimal):
       v = mask.split('.',1)
       try:
         dec = len(v[1])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.