dabo Commit
Revision 5658
Date: 2010-02-07 07:01:38 -0800 (Sun, 07 Feb 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5658

Changed:
U   trunk/dabo/dObject.py

Log:
Wow, I can't believe that this bug was not found earlier!

If a cdxml contained a boolean value False, it was stored as the word 'False'. 
But when the attProperties were being read back in, we were doing bool(val) to 
convert it back, and bool("False") is True. This commit fixes that oversight.



Diff:
Modified: trunk/dabo/dObject.py
===================================================================
--- trunk/dabo/dObject.py       2010-02-06 22:24:06 UTC (rev 5657)
+++ trunk/dabo/dObject.py       2010-02-07 15:01:38 UTC (rev 5658)
@@ -60,14 +60,17 @@
                                        continue
                                typ = type(getattr(self, prop))
                                if not issubclass(typ, basestring):
-                                       try:
-                                               val = typ(val)
-                                       except ValueError, e:
-                                               # Sometimes int values can be 
stored as floats
-                                               if typ in (int, long):
-                                                       val = float(val)
-                                               else:
-                                                       raise e
+                                       if issubclass(typ, bool):
+                                               val = (val == "True")
+                                       else:
+                                               try:
+                                                       val = typ(val)
+                                               except ValueError, e:
+                                                       # Sometimes int values 
can be stored as floats
+                                                       if typ in (int, long):
+                                                               val = float(val)
+                                                       else:
+                                                               raise e
                                properties[prop] = val
 
                # The keyword properties can come from either, both, or none of:



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to