Author: ianb
Date: 2008-11-14 16:48:20 -0700 (Fri, 14 Nov 2008)
New Revision: 3661

Modified:
   FormEncode/trunk/formencode/validators.py
Log:
Add a check for month_style being a valid value

Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py   2008-11-14 23:45:59 UTC (rev 
3660)
+++ FormEncode/trunk/formencode/validators.py   2008-11-14 23:48:20 UTC (rev 
3661)
@@ -1887,7 +1887,6 @@
             ...
         Invalid: Please enter a four-digit year after 1899
 
-
     If you change ``month_style`` you can get European-style dates::
 
         >>> d = DateConverter(month_style='dd/mm/yyyy')
@@ -1942,6 +1941,11 @@
         'wrongFormat': _('Please enter the date in the form %(format)s'),
         }
 
+    def __init__(self, *args, **kw):
+        super(DateConverter, self).__init__(*args, **kw)
+        if not self.month_style in ('dd/mm/yyyy', 'mm/dd/yyyy'):
+            raise TypeError("Bad month_style: %r" % self.month_style)
+
     def _to_python(self, value, state):
         if self.accept_day:
             return self.convert_day(value, state)


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs

Reply via email to