]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/settings/base.py
Fix OSQA 100, show revision number in the powered bi osqa link, in title attribute.
[osqa.git] / forum / settings / base.py
index 5bcf5fc51a6d929c6c82209c15ca2a3b1d22e9a9..e16097027102d0cb6f19b443aab9cf705897a2e8 100644 (file)
@@ -66,7 +66,12 @@ class BaseSetting(object):
         self.set_value(self.default)
 
     def _parse(self, value):
-        return value
+        if not isinstance(value, self.base_type):
+            try:
+                return self.base_type(value)
+            except:
+                pass
+        return value        
 
 
 class Setting(object):
@@ -79,7 +84,8 @@ class Setting(object):
         if deftype in Setting.emulators:
             emul = Setting.emulators[deftype]
         else:
-            emul = type(deftype.__name__ + cls.__name__, (BaseSetting,), {})
+            emul = type(deftype.__name__ + cls.__name__, (BaseSetting,), {'base_type': deftype})
+
             fns = [n for n, f in [(p, getattr(deftype, p)) for p in dir(deftype) if not p in dir(cls)] if callable(f)]
 
             for n in fns: