Commits

Andriy Kornatskyy committed c359133

Updated validation resources; applied relative_date validator in public demo

Comments (0)

Files changed (6)

demos/public/i18n/en/LC_MESSAGES/membership.po

 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/membership/service/bridge.py:30
+#: src/membership/service/bridge.py:29 src/membership/service/bridge.py:30
 msgid "Favorite number"
 msgstr "Favorite number"
 
-#: src/membership/service/bridge.py:31
+#: src/membership/service/bridge.py:30 src/membership/service/bridge.py:31
 msgid "City of birth"
 msgstr "City of birth"
 
-#: src/membership/service/bridge.py:32
+#: src/membership/service/bridge.py:31 src/membership/service/bridge.py:32
 msgid "Favorite color"
 msgstr "Favorite color"
 
-#: src/membership/service/bridge.py:42
+#: src/membership/service/bridge.py:41 src/membership/service/bridge.py:42
 msgid "The username or password provided is incorrect."
 msgstr "The username or password provided is incorrect."
 
-#: src/membership/service/bridge.py:55
+#: src/membership/service/bridge.py:52 src/membership/service/bridge.py:55
 msgid "The user with such username is already registered. Please try another."
 msgstr "The user with such username is already registered. Please try another."
 
-#: src/membership/service/bridge.py:60
+#: src/membership/service/bridge.py:57 src/membership/service/bridge.py:60
 msgid ""
 "The system was unable to create an account for you. Please try again later."
 msgstr ""

demos/public/i18n/en/LC_MESSAGES/validation.po

 msgstr "%Y/%m/%d %H:%M"
 
 #. fallback datetime input formats: 2008/5/18 16:34:52. Use | to separate.
-#: src/wheezy/validation/format.py:22 src/wheezy/validation/format.py:26
-#: src/wheezy/validation/format.py:27
+#: src/wheezy/validation/format.py:22 src/wheezy/validation/format.py:27
 msgid ""
 "%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"
 "%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:109 src/wheezy/validation/model.py:153
 #, 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:112 src/wheezy/validation/model.py:156
 msgid "Input was not in a correct format."
 msgstr "Input was not in a correct format."
 
-#: src/wheezy/validation/model.py:113 src/wheezy/validation/model.py:117
+#: 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:25 src/wheezy/validation/rules.py:26
 msgid "Required field cannot be left blank."
 msgstr "Required field cannot be left blank."
 
-#: src/wheezy/validation/rules.py:95 src/wheezy/validation/rules.py:98
+#: src/wheezy/validation/rules.py:96 src/wheezy/validation/rules.py:98
 #, python-format
 msgid "Required to be a minimum of %(min)d characters in length."
 msgstr "Required to be a minimum of %(min)d characters in length."
 
-#: src/wheezy/validation/rules.py:100 src/wheezy/validation/rules.py:103
+#: src/wheezy/validation/rules.py:101 src/wheezy/validation/rules.py:103
 #, python-format
 msgid "The length must fall within the range %(min)d - %(max)d characters."
 msgstr "The length must fall within the range %(min)d - %(max)d characters."
 
-#: src/wheezy/validation/rules.py:107 src/wheezy/validation/rules.py:110
+#: src/wheezy/validation/rules.py:108 src/wheezy/validation/rules.py:110
 #, python-format
 msgid "Exceeds maximum length of %(max)d."
 msgstr "Exceeds maximum length of %(max)d."
 
-#: src/wheezy/validation/rules.py:232 src/wheezy/validation/rules.py:235
+#: src/wheezy/validation/rules.py:230 src/wheezy/validation/rules.py:235
 #, python-format
 msgid "The value failed equality comparison with \"%(comparand)s\"."
 msgstr "The value failed equality comparison with \"%(comparand)s\"."
 
-#: src/wheezy/validation/rules.py:298
+#: src/wheezy/validation/rules.py:291 src/wheezy/validation/rules.py:298
 msgid "Required to match validation pattern."
 msgstr "Required to match validation pattern."
 
-#: src/wheezy/validation/rules.py:330
+#: src/wheezy/validation/rules.py:321 src/wheezy/validation/rules.py:330
 msgid ""
 "Invalid slug. The value must consist of letters, digits, underscopes and/or "
 "hyphens."
 "Invalid slug. The value must consist of letters, digits, underscopes and/or "
 "hyphens."
 
-#: src/wheezy/validation/rules.py:362
+#: src/wheezy/validation/rules.py:351 src/wheezy/validation/rules.py:362
 msgid "Required to be a valid email address."
 msgstr "Required to be a valid email address."
 
-#: src/wheezy/validation/rules.py:410
+#: src/wheezy/validation/rules.py:397 src/wheezy/validation/rules.py:410
 #, python-format
 msgid "Required to be greater or equal to %(min)s."
 msgstr "Required to be greater or equal to %(min)s."
 
-#: src/wheezy/validation/rules.py:414
+#: src/wheezy/validation/rules.py:401 src/wheezy/validation/rules.py:414
 #, python-format
 msgid "The value must fall within the range %(min)s - %(max)s"
 msgstr "The value must fall within the range %(min)s - %(max)s"
 
-#: src/wheezy/validation/rules.py:421
+#: src/wheezy/validation/rules.py:408 src/wheezy/validation/rules.py:421
 #, python-format
 msgid "Exceeds maximum allowed value of %(max)s."
 msgstr "Exceeds maximum allowed value of %(max)s."
 
+#: src/wheezy/validation/rules.py:624 src/wheezy/validation/rules.py:625
+msgid "The value does not belong to the list of known items."
+msgstr "The value does not belong to the list of known items."
+
+#: src/wheezy/validation/rules.py:655
+msgid "Required to be above a minimum allowed."
+msgstr "Required to be above a minimum allowed."
+
+#: src/wheezy/validation/rules.py:659
+msgid "Must fall within a valid range."
+msgstr "Must fall within a valid range."
+
+#: src/wheezy/validation/rules.py:665
+msgid "Exceeds maximum allowed."
+msgstr "Exceeds maximum allowed."
+
 msgid "Passwords do not match."
 msgstr "Passwords do not match."

demos/public/i18n/membership.po

 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: src/membership/service/bridge.py:30
+#: src/membership/service/bridge.py:29 src/membership/service/bridge.py:30
 msgid "Favorite number"
 msgstr "Favorite number"
 
-#: src/membership/service/bridge.py:31
+#: src/membership/service/bridge.py:30 src/membership/service/bridge.py:31
 msgid "City of birth"
 msgstr "City of birth"
 
-#: src/membership/service/bridge.py:32
+#: src/membership/service/bridge.py:31 src/membership/service/bridge.py:32
 msgid "Favorite color"
 msgstr "Favorite color"
 
-#: src/membership/service/bridge.py:42
+#: src/membership/service/bridge.py:41 src/membership/service/bridge.py:42
 msgid "The username or password provided is incorrect."
 msgstr "The username or password provided is incorrect."
 
-#: src/membership/service/bridge.py:55
+#: src/membership/service/bridge.py:52 src/membership/service/bridge.py:55
 msgid "The user with such username is already registered. Please try another."
 msgstr "The user with such username is already registered. Please try another."
 
-#: src/membership/service/bridge.py:60
+#: src/membership/service/bridge.py:57 src/membership/service/bridge.py:60
 msgid ""
 "The system was unable to create an account for you. Please try again later."
 msgstr ""

demos/public/i18n/ru/LC_MESSAGES/validation.po

 msgid "Input was not in a correct format."
 msgstr "Ввод не в правильном формате."
 
+#: src/wheezy/validation/model.py:130
+msgid "Multiple input was not in a correct format."
+msgstr "Ввод с несколькими значениями был не в правильном формате."
+
 #: src/wheezy/validation/rules.py:12
 msgid "Required field cannot be left blank."
 msgstr "Обязательное поле не может быть пустым."
 msgid "Exceeds maximum allowed value of %(max)s."
 msgstr "Превышает максимально допустимое значение %(max)s."
 
+#: src/wheezy/validation/rules.py:624 src/wheezy/validation/rules.py:625
+msgid "The value does not belong to the list of known items."
+msgstr "Значение не входит в список известных элементов."
+
+#: src/wheezy/validation/rules.py:655
+msgid "Required to be above a minimum allowed."
+msgstr "Обязательно должно быть выше минимально допустимого значения."
+
+#: src/wheezy/validation/rules.py:659
+msgid "Must fall within a valid range."
+msgstr "Должно находиться в пределах допустимого диапазона."
+
+#: src/wheezy/validation/rules.py:665
+msgid "Exceeds maximum allowed."
+msgstr "Превышает допустимый максимум."
+
 msgid "Passwords do not match."
 msgstr "Пароли не совпадают."

demos/public/i18n/validation.po

 msgstr "%Y/%m/%d %H:%M"
 
 #. fallback datetime input formats: 2008/5/18 16:34:52. Use | to separate.
-#: src/wheezy/validation/format.py:22 src/wheezy/validation/format.py:26
-#: src/wheezy/validation/format.py:27
+#: src/wheezy/validation/format.py:22 src/wheezy/validation/format.py:27
 msgid ""
 "%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"
 "%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:109 src/wheezy/validation/model.py:153
 #, 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:112 src/wheezy/validation/model.py:156
 msgid "Input was not in a correct format."
 msgstr "Input was not in a correct format."
 
-#: src/wheezy/validation/model.py:113 src/wheezy/validation/model.py:117
+#: 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:25 src/wheezy/validation/rules.py:26
 msgid "Required field cannot be left blank."
 msgstr "Required field cannot be left blank."
 
-#: src/wheezy/validation/rules.py:95 src/wheezy/validation/rules.py:98
+#: src/wheezy/validation/rules.py:96 src/wheezy/validation/rules.py:98
 #, python-format
 msgid "Required to be a minimum of %(min)d characters in length."
 msgstr "Required to be a minimum of %(min)d characters in length."
 
-#: src/wheezy/validation/rules.py:100 src/wheezy/validation/rules.py:103
+#: src/wheezy/validation/rules.py:101 src/wheezy/validation/rules.py:103
 #, python-format
 msgid "The length must fall within the range %(min)d - %(max)d characters."
 msgstr "The length must fall within the range %(min)d - %(max)d characters."
 
-#: src/wheezy/validation/rules.py:107 src/wheezy/validation/rules.py:110
+#: src/wheezy/validation/rules.py:108 src/wheezy/validation/rules.py:110
 #, python-format
 msgid "Exceeds maximum length of %(max)d."
 msgstr "Exceeds maximum length of %(max)d."
 
-#: src/wheezy/validation/rules.py:232 src/wheezy/validation/rules.py:235
+#: src/wheezy/validation/rules.py:230 src/wheezy/validation/rules.py:235
 #, python-format
 msgid "The value failed equality comparison with \"%(comparand)s\"."
 msgstr "The value failed equality comparison with \"%(comparand)s\"."
 
-#: src/wheezy/validation/rules.py:298
+#: src/wheezy/validation/rules.py:291 src/wheezy/validation/rules.py:298
 msgid "Required to match validation pattern."
 msgstr "Required to match validation pattern."
 
-#: src/wheezy/validation/rules.py:330
+#: src/wheezy/validation/rules.py:321 src/wheezy/validation/rules.py:330
 msgid ""
 "Invalid slug. The value must consist of letters, digits, underscopes and/or "
 "hyphens."
 "Invalid slug. The value must consist of letters, digits, underscopes and/or "
 "hyphens."
 
-#: src/wheezy/validation/rules.py:362
+#: src/wheezy/validation/rules.py:351 src/wheezy/validation/rules.py:362
 msgid "Required to be a valid email address."
 msgstr "Required to be a valid email address."
 
-#: src/wheezy/validation/rules.py:410
+#: src/wheezy/validation/rules.py:397 src/wheezy/validation/rules.py:410
 #, python-format
 msgid "Required to be greater or equal to %(min)s."
 msgstr "Required to be greater or equal to %(min)s."
 
-#: src/wheezy/validation/rules.py:414
+#: src/wheezy/validation/rules.py:401 src/wheezy/validation/rules.py:414
 #, python-format
 msgid "The value must fall within the range %(min)s - %(max)s"
 msgstr "The value must fall within the range %(min)s - %(max)s"
 
-#: src/wheezy/validation/rules.py:421
+#: src/wheezy/validation/rules.py:408 src/wheezy/validation/rules.py:421
 #, python-format
 msgid "Exceeds maximum allowed value of %(max)s."
 msgstr "Exceeds maximum allowed value of %(max)s."
 
+#: src/wheezy/validation/rules.py:624 src/wheezy/validation/rules.py:625
+msgid "The value does not belong to the list of known items."
+msgstr "The value does not belong to the list of known items."
+
+#: src/wheezy/validation/rules.py:655
+msgid "Required to be above a minimum allowed."
+msgstr "Required to be above a minimum allowed."
+
+#: src/wheezy/validation/rules.py:659
+msgid "Must fall within a valid range."
+msgstr "Must fall within a valid range."
+
+#: src/wheezy/validation/rules.py:665
+msgid "Exceeds maximum allowed."
+msgstr "Exceeds maximum allowed."
+
 msgid "Passwords do not match."
 msgstr "Passwords do not match."

demos/public/src/membership/validation.py

 """
 """
 
+from datetime import timedelta
+
 from wheezy.validation import Validator
 from wheezy.validation.rules import compare
 from wheezy.validation.rules import length
 from wheezy.validation.rules import required
 from wheezy.validation.rules import range
+from wheezy.validation.rules import relative_date
 
 
 _ = lambda s: s
     'credential': credential_validator,
     'account': account_validator,
     'answer': [required, length(min=1, max=20)],
-    'date_of_birth': [required]
+    'date_of_birth': [
+        required,
+        relative_date(
+            min=timedelta(days=-80 * 365),
+            max=timedelta(days=-7 * 365))
+    ]
 })
 
 password_match_validator = Validator({