Commits

Andriy Kornatskyy committed fcbda47

Eliminated RelativeUTCUnixTimeDeltaRule so it doesn't cause confusion with RelativeUnixTimeDeltaRule that is in UTC.

Comments (0)

Files changed (5)

doc/userguide.rst

   :py:class:`~wheezy.validation.rules.RelativeDateTimeDeltaRule`,
   :py:class:`~wheezy.validation.rules.RelativeUTCDateTimeDeltaRule`,
   :py:class:`~wheezy.validation.rules.RelativeTZDateTimeDeltaRule`.
-* ``relative_timestamp``, ``relative_unixtime``, ``relative_utctimestamp``,
-  ``relative_utcunixtime``. Check if value is in relative unix timestamp
-  range per local, UTC. See
+* ``relative_timestamp``, ``relative_unixtime``. Check if value is in
+  relative unix timestamp range. See
   :py:class:`~wheezy.validation.rules.RelativeUnixTimeDeltaRule`.
 * ``adapter``, ``int_adapter``. Adapts a value according to converter.
   This is useful when you need to keep string input in model but validate

i18n/en/LC_MESSAGES/validation.po

 msgid "Exceeds maximum allowed."
 msgstr "Exceeds maximum allowed."
 
-#: src/wheezy/validation/rules.py:712
+#: src/wheezy/validation/rules.py:703
 msgid "Required to satisfy a converter format."
 msgstr "Required to satisfy a converter format."
 
-#: src/wheezy/validation/rules.py:732
+#: src/wheezy/validation/rules.py:723
 msgid "Required to satisfy an integer format."
 msgstr "Required to satisfy an integer format."

i18n/ru/LC_MESSAGES/validation.po

File contents unchanged.

src/wheezy/validation/rules.py

         return int(unixtime())
 
 
-class RelativeUTCUnixTimeDeltaRule(RelativeDeltaRule):
-    """ Check if value is in relative unix range UTC time.
-    """
-    __slots__ = ()
-
-    def now(self):
-        return int(unixtime()) + altzone
-
-
 class IgnoreRule(object):
     """ The idea behind this rule is to be able to substitute
         any validation rule by this one that always succeed:
 relative_unixtime = RelativeUnixTimeDeltaRule
 relative_utcdate = RelativeUTCDateDeltaRule
 relative_utcdatetime = RelativeUTCDateTimeDeltaRule
-relative_utctimestamp = RelativeUTCUnixTimeDeltaRule
-relative_utcunixtime = RelativeUTCUnixTimeDeltaRule
 required = RequiredRule()
 scientific = ScientificRule()
 slug = SlugRule()

src/wheezy/validation/tests/test_rules.py

         from wheezy.validation.rules import relative_timestamp
         assert relative_unixtime == RelativeUnixTimeDeltaRule
         assert relative_unixtime == relative_timestamp
-
-
-class RelativeUTCUnixTimeDeltaRule(unittest.TestCase, RelativeDeltaRuleMixin):
-
-    def setUp(self):
-        from wheezy.validation.rules import RelativeUTCUnixTimeDeltaRule
-        from datetime import datetime
-
-        class Proxy(RelativeUTCUnixTimeDeltaRule):
-            def now(self):
-                t = super(Proxy, self).now()
-                return datetime.fromtimestamp(t)
-
-        self.shortcut = Proxy
-        self.Rule = RelativeUTCUnixTimeDeltaRule
-
-    def test_shortcut(self):
-        """ Test rule shortcut.
-        """
-        from wheezy.validation.rules import RelativeUTCUnixTimeDeltaRule
-        from wheezy.validation.rules import relative_utcunixtime
-        from wheezy.validation.rules import relative_utctimestamp
-        assert relative_utcunixtime == RelativeUTCUnixTimeDeltaRule
-        assert relative_utcunixtime == relative_utctimestamp