[Mpuls-commits] r1580 - in wasko/branches/2.0: . waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 15 21:08:56 CET 2010


Author: bh
Date: 2010-02-15 21:08:55 +0100 (Mon, 15 Feb 2010)
New Revision: 1580

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/waskaweb/lib/validators.py
Log:
* waskaweb/lib/validators.py: Explicitly improt ForEach from
formencode and Bool, Int and String from formencode.validators and
use the short names to refer to them.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-15 20:02:56 UTC (rev 1579)
+++ wasko/branches/2.0/ChangeLog	2010-02-15 20:08:55 UTC (rev 1580)
@@ -1,5 +1,11 @@
 2010-02-15  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/lib/validators.py: Explicitly improt ForEach from
+	formencode and Bool, Int and String from formencode.validators and
+	use the short names to refer to them.
+
+2010-02-15  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/lib/validators.py: Fix formatting.
 
 2010-02-15  Bernhard Herzog  <bh at intevation.de>

Modified: wasko/branches/2.0/waskaweb/lib/validators.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-15 20:02:56 UTC (rev 1579)
+++ wasko/branches/2.0/waskaweb/lib/validators.py	2010-02-15 20:08:55 UTC (rev 1580)
@@ -29,6 +29,8 @@
 import locale
 
 import formencode
+from formencode import ForEach
+from formencode.validators import Bool, Int, String
 
 from pylons import session, g
 from pylons.i18n import _
@@ -62,50 +64,50 @@
 
 class CasePartSelectionForm(BaseFormValidator):
 
-    documents = formencode.validators.Int(if_missing=0)
-    appointments = formencode.validators.Int(if_missing=1)
-    logbook = formencode.validators.Int(if_missing=0)
+    documents = Int(if_missing=0)
+    appointments = Int(if_missing=1)
+    logbook = Int(if_missing=0)
 
 
 for i in xrange(1, 33):
     setattr(CasePartSelectionForm, 'form_section_%02d' % i,
-            formencode.validators.Int(if_missing=0))
+            Int(if_missing=0))
 
-#    form_section_0 = formencode.validators.Int(if_missing=0)
-#    form_section_1 = formencode.validators.Int(if_missing=0)
-#    form_section_2 = formencode.validators.Int(if_missing=0)
-#    form_section_3 = formencode.validators.Int(if_missing=0)
-#    form_section_4 = formencode.validators.Int(if_missing=0)
-#    form_section_5 = formencode.validators.Int(if_missing=0)
-#    form_section_6 = formencode.validators.Int(if_missing=0)
-#    form_section_7 = formencode.validators.Int(if_missing=0)
-#    form_section_8 = formencode.validators.Int(if_missing=0)
-#    form_section_9 = formencode.validators.Int(if_missing=0)
-#    form_section_10 = formencode.validators.Int(if_missing=0)
-#    form_section_11 = formencode.validators.Int(if_missing=0)
-#    form_section_12 = formencode.validators.Int(if_missing=0)
-#    form_section_13 = formencode.validators.Int(if_missing=0)
-#    form_section_14 = formencode.validators.Int(if_missing=0)
-#    form_section_15 = formencode.validators.Int(if_missing=0)
-#    form_section_16 = formencode.validators.Int(if_missing=0)
-#    form_section_17 = formencode.validators.Int(if_missing=0)
+#    form_section_0 = Int(if_missing=0)
+#    form_section_1 = Int(if_missing=0)
+#    form_section_2 = Int(if_missing=0)
+#    form_section_3 = Int(if_missing=0)
+#    form_section_4 = Int(if_missing=0)
+#    form_section_5 = Int(if_missing=0)
+#    form_section_6 = Int(if_missing=0)
+#    form_section_7 = Int(if_missing=0)
+#    form_section_8 = Int(if_missing=0)
+#    form_section_9 = Int(if_missing=0)
+#    form_section_10 = Int(if_missing=0)
+#    form_section_11 = Int(if_missing=0)
+#    form_section_12 = Int(if_missing=0)
+#    form_section_13 = Int(if_missing=0)
+#    form_section_14 = Int(if_missing=0)
+#    form_section_15 = Int(if_missing=0)
+#    form_section_16 = Int(if_missing=0)
+#    form_section_17 = Int(if_missing=0)
 
 
 class NewCaseForm(BaseFormValidator):
 
-    name = formencode.validators.String()
-    vorname = formencode.validators.String()
-    addresse_strasse = formencode.validators.String()
-    addresse_strassenr = formencode.validators.String()
-    addresse_ort = formencode.validators.String()
-    statement_signed = formencode.validators.Bool(if_missing=False)
-    aufnahme_typ = formencode.validators.Int(if_missing=0)
+    name = String()
+    vorname = String()
+    addresse_strasse = String()
+    addresse_strassenr = String()
+    addresse_ort = String()
+    statement_signed = Bool(if_missing=False)
+    aufnahme_typ = Int(if_missing=0)
 
 
 class SearchCaseForm(BaseFormValidator):
 
-    gender = formencode.validators.Int(if_missing='-2')
-    cm_state = formencode.validators.Int(if_missing=None)
+    gender = Int(if_missing='-2')
+    cm_state = Int(if_missing=None)
 
 
 class SearchAgencyForm(SearchCaseForm):
@@ -117,27 +119,27 @@
 
     filter_extra_fields = True
 
-    all_cases = formencode.validators.Int(if_missing=0)
-    action = formencode.validators.String(not_empty=True)
-    case_id = formencode.ForEach(formencode.validators.Int())
+    all_cases = Int(if_missing=0)
+    action = String(not_empty=True)
+    case_id = ForEach(Int())
 
 
 class AgencyBundleActionForm(BaseFormValidator):
 
     filter_extra_fields = True
 
-    all_cases = formencode.validators.Int(if_missing=0)
-    action = formencode.validators.String(not_empty=True)
-    agency_id = formencode.ForEach(formencode.validators.String())
+    all_cases = Int(if_missing=0)
+    action = String(not_empty=True)
+    agency_id = ForEach(String())
 
 
 class DeleteUserHelperForm(BaseFormValidator):
 
     filter_extra_fields = True
 
-    editor = formencode.validators.Int()
-    user_id = formencode.validators.Int()
-    case_id = formencode.ForEach(formencode.validators.Int())
+    editor = Int()
+    user_id = Int()
+    case_id = ForEach(Int())
 
 
 class SetEditorForm(BaseFormValidator):
@@ -159,8 +161,8 @@
 
     filter_extra_fields = True
 
-    case_id = formencode.validators.Int()
-    standin = formencode.ForEach(formencode.validators.Int())
+    case_id = Int()
+    standin = ForEach(Int())
 
 
 class KeineAngabe(formencode.validators.FancyValidator):
@@ -182,7 +184,7 @@
 
     date = DateCheck(not_empty=True)
     time = TimeCheck(not_empty=True)
-    duration = formencode.validators.Int()
+    duration = Int()
     short_notice = StringTooLong()
 
 
@@ -198,29 +200,31 @@
 
 class EvaluationFormValidator(BaseFormValidator):
 
-    id = formencode.validators.String(if_missing='0')
-    agencyid = formencode.validators.String(if_missing=g.mpuls_config.get('common', 'agencyname'))
+    id = String(if_missing='0')
+    agencyid = String(if_missing=g.mpuls_config.get('common', 'agencyname'))
+
     start_date = MyDateConverter(not_empty=True, if_missing='')
     end_date = MyDateConverter(not_empty=True, if_missing='')
-    start_date_field = formencode.validators.String(if_missing=g.mpuls_config.get('evaloptions', 'default-start-date-field'))
-    end_date_field = formencode.validators.String(if_missing=g.mpuls_config.get('evaloptions', 'default-end-date-field'))
-    typelist = formencode.ForEach(formencode.validators.String(),
-                                  convert_to_list=True)
-    type_ending = formencode.ForEach(formencode.validators.String(),
-                                     convert_to_list=True)
-    phase = formencode.ForEach(formencode.validators.String(),
-                               convert_to_list=True)
-    show_percent = formencode.validators.Bool(if_missing=False)
 
+    start_date_field = String(if_missing=g.mpuls_config.get('evaloptions',
+                                                   'default-start-date-field'))
+    end_date_field = String(if_missing=g.mpuls_config.get('evaloptions',
+                                                     'default-end-date-field'))
 
+    typelist = ForEach(String(), convert_to_list=True)
+    type_ending = ForEach(String(), convert_to_list=True)
+    phase = ForEach(String(), convert_to_list=True)
+    show_percent = Bool(if_missing=False)
+
+
 class ExtraTimeFormValidator1(BaseFormValidator):
 
     allow_extra_fields = True
     filter_extra_fields = True
 
     cm_datum_verlaengerung_1 = DateCheck(not_empty=True)
-    cm_bestaet_verlaengerung_1 = formencode.validators.String(if_missing='')
-    cm_anmerk_verlaengerung_1 = formencode.validators.String()
+    cm_bestaet_verlaengerung_1 = String(if_missing='')
+    cm_anmerk_verlaengerung_1 = String()
 
 
 class ExtraTimeFormValidator2(BaseFormValidator):
@@ -229,8 +233,8 @@
     filter_extra_fields = True
 
     cm_datum_verlaengerung_2 = DateCheck(not_empty=True)
-    cm_bestaet_verlaengerung_2 = formencode.validators.String(if_missing='')
-    cm_anmerk_verlaengerung_2 = formencode.validators.String()
+    cm_bestaet_verlaengerung_2 = String(if_missing='')
+    cm_anmerk_verlaengerung_2 = String()
 
 
 class RenewFormValidator(BaseFormValidator):
@@ -238,8 +242,8 @@
     allow_extra_fields = True
     filter_extra_fields = True
 
-    cm_neuauf_genehm = formencode.validators.String()
-    anmerkungen = formencode.validators.String()
+    cm_neuauf_genehm = String()
+    anmerkungen = String()
 
 
 class ReopenFormValidator1(BaseFormValidator):
@@ -247,10 +251,10 @@
     allow_extra_fields = True
     filter_extra_fields = True
 
-    cm_wiederauf_genehm_1 = formencode.validators.String()
+    cm_wiederauf_genehm_1 = String()
     cm_wiederauf_genehm_datum_1 = DateCheck(not_empty=True)
     cm_wiederauf_datum_bis_1 = DateCheck(not_empty=True)
-    anmerkungen = formencode.validators.String(not_empty=True)
+    anmerkungen = String(not_empty=True)
 
 
 class ReopenFormValidator1abgel(BaseFormValidator):
@@ -258,10 +262,10 @@
     allow_extra_fields = True
     filter_extra_fields = True
 
-    cm_wiederauf_genehm_1 = formencode.validators.String()
-    cm_wiederauf_genehm_datum_1 = formencode.validators.String()
-    cm_wiederauf_datum_bis_1 = formencode.validators.String()
-    anmerkungen = formencode.validators.String()
+    cm_wiederauf_genehm_1 = String()
+    cm_wiederauf_genehm_datum_1 = String()
+    cm_wiederauf_datum_bis_1 = String()
+    anmerkungen = String()
 
 
 class ReopenFormValidator2(BaseFormValidator):
@@ -269,9 +273,9 @@
     allow_extra_fields = True
     filter_extra_fields = True
 
-    cm_wiederauf_genehm_2 = formencode.validators.String()
+    cm_wiederauf_genehm_2 = String()
     cm_wiederauf_datum_bis_2 = DateCheck(not_empty=True)
-    anmerkungen = formencode.validators.String(not_empty=True)
+    anmerkungen = String(not_empty=True)
 
 
 class ReopenFormValidator2abgel(BaseFormValidator):
@@ -279,18 +283,18 @@
     allow_extra_fields = True
     filter_extra_fields = True
 
-    cm_wiederauf_genehm_2 = formencode.validators.String()
-    cm_wiederauf_datum_bis_2 = formencode.validators.String()
-    anmerkungen = formencode.validators.String()
+    cm_wiederauf_genehm_2 = String()
+    cm_wiederauf_datum_bis_2 = String()
+    anmerkungen = String()
 
 
 class WiederaufnahmeCaseForm(BaseFormValidator):
 
     cm_dok_datum_beendigung = DateCheck(not_empty=True)
-    cm_dok_end_verm = formencode.validators.String()
+    cm_dok_end_verm = String()
     cm_wiederauf_genehm_datum_1 = DateCheck(not_empty=True)
     cm_wiederauf_datum_bis_1 = DateCheck(not_empty=True)
-    cm2c_t = formencode.validators.String(not_empty=True)
+    cm2c_t = String(not_empty=True)
     cm_dok_end_verm = KeineAngabe()
 
 
@@ -298,6 +302,6 @@
 
     cm_dok_datum_beendigung = DateCheck(not_empty=True)
     cm_dok_end_sonst = KeineAngabe()
-    cm2c_t = formencode.validators.String()
+    cm2c_t = String()
 
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8



More information about the Mpuls-commits mailing list