Commits

Andriy Kornatskyy committed e8e3f37

Added support for class level members update

  • Participants
  • Parent commits 68214a2

Comments (0)

Files changed (3)

File i18n/en/LC_MESSAGES/validation.po

 "%Y/%m/%d %H:%M:%S|%m/%d/%Y %H:%M|%m/%d/%Y %H:%M:%S|%Y-%m-%d %H:%M|%Y-%m-%d "
 "%H:%M:%S|%m/%d/%y %H:%M|%m/%d/%y %H:%M:%S"
 
-#: src/wheezy/validation/model.py:109 src/wheezy/validation/model.py:153
+#: src/wheezy/validation/model.py:130 src/wheezy/validation/model.py:132
+#: src/wheezy/validation/model.py:135
+msgid "Multiple input was not in a correct format."
+msgstr "Multiple input was not in a correct format."
+
+#: src/wheezy/validation/model.py:145 src/wheezy/validation/model.py:147
+#: src/wheezy/validation/model.py:150
+#, python-format
+msgid "The value '%s' is not in one of supported formats."
+msgstr "The value '%s' is not in one of supported formats."
+
+#: src/wheezy/validation/model.py:155 src/wheezy/validation/model.py:158
 #, python-format
 msgid "The value '%s' is invalid."
 msgstr "The value '%s' is invalid."
 
-#: src/wheezy/validation/model.py:112 src/wheezy/validation/model.py:156
+#: src/wheezy/validation/model.py:158 src/wheezy/validation/model.py:161
 msgid "Input was not in a correct format."
 msgstr "Input was not in a correct format."
 
-#: src/wheezy/validation/model.py:130
-msgid "Multiple input was not in a correct format."
-msgstr "Multiple input was not in a correct format."
-
-#: src/wheezy/validation/model.py:145
-#, python-format
-msgid "The value '%s' is not in one of supported formats."
-msgstr "The value '%s' is not in one of supported formats."
-
 #: src/wheezy/validation/rules.py:25 src/wheezy/validation/rules.py:26
 msgid "Required field cannot be left blank."
 msgstr "Required field cannot be left blank."

File i18n/validation.po

 "%Y/%m/%d %H:%M:%S|%m/%d/%Y %H:%M|%m/%d/%Y %H:%M:%S|%Y-%m-%d %H:%M|%Y-%m-%d "
 "%H:%M:%S|%m/%d/%y %H:%M|%m/%d/%y %H:%M:%S"
 
-#: src/wheezy/validation/model.py:109 src/wheezy/validation/model.py:153
+#: src/wheezy/validation/model.py:130 src/wheezy/validation/model.py:132
+#: src/wheezy/validation/model.py:135
+msgid "Multiple input was not in a correct format."
+msgstr "Multiple input was not in a correct format."
+
+#: src/wheezy/validation/model.py:145 src/wheezy/validation/model.py:147
+#: src/wheezy/validation/model.py:150
+#, python-format
+msgid "The value '%s' is not in one of supported formats."
+msgstr "The value '%s' is not in one of supported formats."
+
+#: src/wheezy/validation/model.py:155 src/wheezy/validation/model.py:158
 #, python-format
 msgid "The value '%s' is invalid."
 msgstr "The value '%s' is invalid."
 
-#: src/wheezy/validation/model.py:112 src/wheezy/validation/model.py:156
+#: src/wheezy/validation/model.py:158 src/wheezy/validation/model.py:161
 msgid "Input was not in a correct format."
 msgstr "Input was not in a correct format."
 
-#: src/wheezy/validation/model.py:130
-msgid "Multiple input was not in a correct format."
-msgstr "Multiple input was not in a correct format."
-
-#: src/wheezy/validation/model.py:145
-#, python-format
-msgid "The value '%s' is not in one of supported formats."
-msgstr "The value '%s' is not in one of supported formats."
-
 #: src/wheezy/validation/rules.py:25 src/wheezy/validation/rules.py:26
 msgid "Required field cannot be left blank."
 msgstr "Required field cannot be left blank."

File src/wheezy/validation/model.py

         ``values`` - a dict of lists or strings
 
         >>> class User(object):
+        ...     name = ''
         ...     def __init__(self):
-        ...         self.name = ''
         ...         self.age = 0
         ...         self.balance = Decimal(0)
         ...         self.birthday = date.min
         getter = model_type.__getitem__
         setter = model_type.__setitem__
     else:
-        attribute_names = model.__dict__
+        attribute_names = model.__dict__.keys()
+        attribute_names.extend([name for name in model.__class__.__dict__
+                                    if name[:1] != '_'])
         getter = getattr
         setter = setattr
     succeed = True