[Mpuls-commits] r1405 - wasko/branches/2.0/waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 9 16:17:40 CET 2010


Author: torsten
Date: 2010-02-09 16:17:40 +0100 (Tue, 09 Feb 2010)
New Revision: 1405

Modified:
   wasko/branches/2.0/waskaweb/lib/validators.py
Log:
* waskaweb/lib/validators.py (MaxMinInt): Deleted. 


Modified: wasko/branches/2.0/waskaweb/lib/validators.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-09 15:16:32 UTC (rev 1404)
+++ wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-09 15:17:40 UTC (rev 1405)
@@ -50,54 +50,6 @@
         except:
             raise formencode.Invalid(self.message("wrong_format", state), value, state)
 
-class MaxMinInt(formencode.validators.FancyValidator):
-
-    """
-    Convert a value to an integer.
-
-    Example::
-
-        >>> Int.to_python('10')
-        10
-        >>> Int.to_python('ten')
-        Traceback (most recent call last):
-            ...
-        Invalid: Please enter an integer value
-    """
-
-    messages = {
-        'integer': u"Bitte geben Sie einen Ganzzahlenwert ein.",
-        'tooLow': u"Bitte geben Sie einen Wert größer oder gleich  %(min)i ein.",
-        'tooHigh': u"Bitte geben Sie einen Wert kleiner oder gleich %(max)i ein."
-        }
-
-    min = None
-    max = None
-
-    def __initargs__(self, args):
-        if self.min != None:
-            self.min = int(self.min)
-        if self.max != None:
-            self.max = int(self.max)
-
-
-    def _to_python(self, value, state):
-        try:
-            return int(value)
-        except (ValueError, TypeError):
-            raise formencode.Invalid(self.message('integer', state),
-                          value, state)
-
-    def validate_python(self, value, state):
-        if self.min != None and value < self.min:
-            msg = self.message("tooLow", state, min=self.min)
-            raise formencode.Invalid(msg, value, state)
-        if self.max != None and value > self.max:
-            msg = self.message("tooHigh", state, max=self.max)
-            raise formencode.Invalid(msg, value, state)
-
-    _from_python = _to_python
-
 class LoginCheck(formencode.validators.FancyValidator):
 
     psql_max = 63



More information about the Mpuls-commits mailing list