[Mpuls-commits] r3324 - wasko/trunk/waskoweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 3 17:13:34 CEST 2010


Author: torsten
Date: 2010-08-03 17:13:33 +0200 (Tue, 03 Aug 2010)
New Revision: 3324

Modified:
   wasko/trunk/waskoweb/lib/validators.py
Log:
* waskoweb/lib/validators.py (WiederaufnahmeCaseForm): Implemented all
	rules as formencode validators.


Modified: wasko/trunk/waskoweb/lib/validators.py
===================================================================
--- wasko/trunk/waskoweb/lib/validators.py	2010-08-03 15:10:25 UTC (rev 3323)
+++ wasko/trunk/waskoweb/lib/validators.py	2010-08-03 15:13:33 UTC (rev 3324)
@@ -24,8 +24,9 @@
 # European Social Fund resources.
 
 from formencode import ForEach
-from formencode.validators import Bool, String, Int
-from mpulsweb.lib.validators import BaseFormValidator, DateCheck, KeineAngabe
+from formencode.validators import Bool, String, Int, DateValidator
+from mpulsweb.lib.validators import BaseFormValidator, DateCheck, KeineAngabe, \
+     DateOrder, MyDateConverter, TimeDeltaCheck
 
 class NewCaseForm(BaseFormValidator):
 
@@ -114,14 +115,18 @@
 
 class WiederaufnahmeCaseForm(BaseFormValidator):
 
-    cm_dok_datum_beendigung = DateCheck(not_empty=True)
+    cm_dok_datum_beendigung = MyDateConverter(not_empty=True, month_style='dd.mm.jjjj')
     cm_dok_end_verm = String()
-    cm_wiederauf_genehm_datum_1 = DateCheck(not_empty=True)
-    cm_wiederauf_datum_bis_1 = DateCheck(not_empty=True)
+    cm_wiederauf_genehm_datum_1 = MyDateConverter(not_empty=True, month_style='dd.mm.jjjj')
+    cm_wiederauf_datum_bis_1 = MyDateConverter(not_empty=True, month_style='dd.mm.jjjj')
     cm2c_t = String(not_empty=True)
     cm_dok_end_verm = KeineAngabe()
+    chained_validators = [
+        DateOrder('cm_dok_datum_beendigung', 'cm_wiederauf_genehm_datum_1'),
+        DateOrder('cm_wiederauf_genehm_datum_1', 'cm_wiederauf_datum_bis_1'),
+        TimeDeltaCheck('cm_wiederauf_genehm_datum_1', 'cm_wiederauf_datum_bis_1', days=93)
+    ]
 
-
 class NeuaufnahmeCaseForm(BaseFormValidator):
 
     cm_dok_datum_beendigung = DateCheck(not_empty=True)



More information about the Mpuls-commits mailing list