[Mpuls-commits] r5749 - base/trunk/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jan 5 10:53:45 CET 2012


Author: torsten
Date: 2012-01-05 10:53:28 +0100 (Thu, 05 Jan 2012)
New Revision: 5749

Modified:
   base/trunk/mpulsweb/controllers/evaluate.py
Log:
Add new function whoch returns the evaluation validator. Now a app specific
validator can be used by overwriting this function.


Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py	2012-01-03 14:31:49 UTC (rev 5748)
+++ base/trunk/mpulsweb/controllers/evaluate.py	2012-01-05 09:53:28 UTC (rev 5749)
@@ -138,6 +138,9 @@
         session.save()
         return self.evaluate(id)
 
+    def _get_validator(self):
+        return EvaluationFormValidator()
+
     def evaluate(self, id=None):
         c.evalconfig = EvaluationConfig(get_configfile(id), None, None, None,
                                         None, None, None, None, None)
@@ -158,7 +161,8 @@
         evaloptions = dict()
         for options in option_sources:
             evaloptions.update(options)
-        defaults = EvaluationFormValidator().from_python(evaloptions)
+        validator = self._get_validator()
+        defaults = validator.from_python(evaloptions)
 
         c.phases = PhaseFactory().build()
         c.eval_config_id = id
@@ -275,7 +279,7 @@
         """Return an HTML file containing the result of one or more evaluations.
         """
         params = formencode.variabledecode.variable_decode(request.params)
-        validator = EvaluationFormValidator()
+        validator = self._get_validator()
 
         id = int(params['id'])
         config_file = get_configfile(id)



More information about the Mpuls-commits mailing list