Commits

aryehg committed a8b41e3

allow for flags=['flag1', 'flag2', ...] to be passed into the Field at creation

  • Participants
  • Parent commits b969a39

Comments (0)

Files changed (2)

 - Rodrigo Moraes
 - Sebastian Wiesner
 - Vinay Sajip
+- Aryeh Goldsmith

wtforms/fields/core.py

 
     def __init__(self, label=None, validators=None, filters=tuple(),
                  description=u'', id=None, default=None, widget=None, options={},
-                 _form=None, _name=None, _prefix='', _translations=None):
+                 flags=None, _form=None, _name=None, _prefix='', _translations=None):
         """
         Construct a new field.
 
             self.widget = widget
 
         for v in self.validators:
-            flags = getattr(v, 'field_flags', ())
-            for f in flags:
+            field_flags = getattr(v, 'field_flags', ())
+            for f in field_flags:
                 setattr(self.flags, f, True)
 
+        if flags is not None:
+          print "GOT FLAGS"
+          for f in flags:
+            print "SETING FLAG %s" % f
+            setattr(self.flags, f, True)
+
 
     def __unicode__(self):
         """