wingo - in flumotion/trunk: . flumotion/common

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Wed Jul 4 16:08:15 CEST 2007


Author: wingo
Date: Wed Jul  4 16:08:10 2007
New Revision: 5299

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/common/config.py
Log:
2007-07-04  Andy Wingo  <wingo at pobox.com>

	* flumotion/common/config.py (parsePropertyValue): Allow native
	bools and fractions, as we do with other types. Fixes #682.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Wed Jul  4 16:08:10 2007
@@ -1,3 +1,8 @@
+2007-07-04  Andy Wingo  <wingo at pobox.com>
+
+	* flumotion/common/config.py (parsePropertyValue): Allow native
+	bools and fractions, as we do with other types. Fixes #682.
+
 2007-07-04  Michael Smith <msmith at fluendo.com>
 
 	* flumotion/component/base/watcher.py:

Modified: flumotion/trunk/flumotion/common/config.py
==============================================================================
--- flumotion/trunk/flumotion/common/config.py	(original)
+++ flumotion/trunk/flumotion/common/config.py	Wed Jul  4 16:08:10 2007
@@ -86,10 +86,17 @@
             return s
     def strWithoutNewlines(s):
         return tryStr(' '.join([x.strip() for x in s.split('\n')]))
-    def fraction(s):
+    def fraction(v):
         def frac(num, denom=1):
             return int(num), int(denom)
-        return frac(*s.split('/'))
+        if isinstance(v, basestring):
+            return frac(*v.split('/'))
+        else:
+            return frac(*v)
+    def boolean(v):
+        if isinstance(v, bool):
+            return v
+        return common.strToBool(v)
 
     try:
         # yay!
@@ -97,7 +104,7 @@
                 'rawstring': tryStr,
                 'int': int,
                 'long': long,
-                'bool': common.strToBool,
+                'bool': boolean,
                 'float': float,
                 'fraction': fraction}[type](value)
     except KeyError:


More information about the flumotion-commit mailing list