Commit 3dcc7b28 authored by Serge S. Koval's avatar Serge S. Koval

Merge pull request #1080 from pawl/fix_form_rule_compat

fix backwards compat issue with form rules + flask.ext.admin
parents e4f4bbe0 009e7a41
...@@ -400,12 +400,13 @@ class RuleSet(object): ...@@ -400,12 +400,13 @@ class RuleSet(object):
result = [] result = []
for r in rules: for r in rules:
if isinstance(r, BaseRule): if isinstance(r, string_types):
result.append(r.configure(self, parent))
elif isinstance(r, string_types):
result.append(self.convert_string(r).configure(self, parent)) result.append(self.convert_string(r).configure(self, parent))
else: else:
raise ValueError('Dont know how to convert %s' % repr(r)) try:
result.append(r.configure(self, parent))
except AttributeError:
raise TypeError('Could not convert "%s" to rule' % repr(r))
return result return result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment