[Mpuls-commits] r3472 - in base/trunk: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Aug 27 20:14:53 CEST 2010


Author: bh
Date: 2010-08-27 20:14:50 +0200 (Fri, 27 Aug 2010)
New Revision: 3472

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/lib/search.py
Log:
* mpulsweb/lib/search.py (CaseSearch.validate_form_params): New.
Validate search form parameters.  It's a method on the search
object now so that it can be extended by MPuls applications.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-27 17:42:16 UTC (rev 3471)
+++ base/trunk/ChangeLog	2010-08-27 18:14:50 UTC (rev 3472)
@@ -1,5 +1,11 @@
 2010-08-27  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/search.py (CaseSearch.validate_form_params): New.
+	Validate search form parameters.  It's a method on the search
+	object now so that it can be extended by MPuls applications.
+
+2010-08-27  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/lib/app_globals.py (Globals._init_case): Instantiate
 	case_search.
 

Modified: base/trunk/mpulsweb/lib/search.py
===================================================================
--- base/trunk/mpulsweb/lib/search.py	2010-08-27 17:42:16 UTC (rev 3471)
+++ base/trunk/mpulsweb/lib/search.py	2010-08-27 18:14:50 UTC (rev 3472)
@@ -117,6 +117,16 @@
             retrieve = "%s," % retrieve
         return self.SEARCH_FIELDS % retrieve
 
+    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
+        return SearchCaseForm().to_python(params)
+
     def convert_form_parameters(self, options, user):
         """Convert form parameters to search options.
         The parameter user is the user object for the current user.



More information about the Mpuls-commits mailing list