[Mpuls-commits] r5431 - waska/trunk/waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 7 21:13:26 CEST 2011


Author: bh
Date: 2011-10-07 21:13:25 +0200 (Fri, 07 Oct 2011)
New Revision: 5431

Modified:
   waska/trunk/waskaweb/lib/search.py
Log:
Use extra_validators instead of validate_form_params in AppMixin.
The extra_validators validators method makes it easier to just add
validation for additional parameters and now the mixin should work for
both the normal case search and the search on the evaluation server
(although WASKA doesn't currently use this code on the evaluation
server).


Modified: waska/trunk/waskaweb/lib/search.py
===================================================================
--- waska/trunk/waskaweb/lib/search.py	2011-10-07 19:07:16 UTC (rev 5430)
+++ waska/trunk/waskaweb/lib/search.py	2011-10-07 19:13:25 UTC (rev 5431)
@@ -45,17 +45,10 @@
 
     MULTI_OPTIONS = ("type_ending",)
 
-    def validate_form_params(self, params):
-        # FIXME: We import SearchCaseForm here because importing it
-        # during import doesn't work.  The validators module performs
-        # translations and accesses app_globals during import, so it has
-        # to be imported when a HTTP-request is being handled.  The
-        # search module is imported early on when the application starts
-        # so validators cannot be imported then.
-        from mpulsweb.lib.validators import SearchCaseForm
-        validator = SearchCaseForm(type_ending=ForEach(Int(),
-                                                       convert_to_list=True))
-        return validator.to_python(params)
+    def extra_validators(self):
+        validators = super(AppMixin, self).extra_validators()
+        validators["type_ending"] = ForEach(Int(), convert_to_list=True)
+        return validators
 
     def convert_form_parameters(self, options, user, extended):
         search = super(AppMixin, self).convert_form_parameters(options, user,



More information about the Mpuls-commits mailing list