X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/87e592dc4c9e0321635350da8c9f1624554a604f..efc62f41304bf4bd783018f6008f3472f4c4ad92:/forum/settings/base.py?ds=sidebyside diff --git a/forum/settings/base.py b/forum/settings/base.py index 5bcf5fc..f640a7c 100644 --- a/forum/settings/base.py +++ b/forum/settings/base.py @@ -66,7 +66,10 @@ class BaseSetting(object): self.set_value(self.default) def _parse(self, value): - return value + try: + return self.base_type(value) + except: + return value class Setting(object): @@ -79,7 +82,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: