[Mpuls-commits] r3952 - in base/trunk: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 8 22:08:06 CEST 2010


Author: bh
Date: 2010-10-08 22:08:05 +0200 (Fri, 08 Oct 2010)
New Revision: 3952

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/evaluate.py
Log:
* mpulsweb/controllers/evaluate.py (get_search_options): Do not
convert the dates to strings.  Leave them as python date objects.
(EvaluateController.evaluate): Use the EvaluationFormValidator's
from_python method to convert to the string representation used in
the evaluation form.  This way, it's OK to have date objects in
the dict returned by get_search_options


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-10-08 20:04:31 UTC (rev 3951)
+++ base/trunk/ChangeLog	2010-10-08 20:08:05 UTC (rev 3952)
@@ -1,5 +1,14 @@
 2010-10-08  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/evaluate.py (get_search_options): Do not
+	convert the dates to strings.  Leave them as python date objects.
+	(EvaluateController.evaluate): Use the EvaluationFormValidator's
+	from_python method to convert to the string representation used in
+	the evaluation form.  This way, it's OK to have date objects in
+	the dict returned by get_search_options
+
+2010-10-08  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/evaluate.py (get_search_options): Refactor
 	to make handling of the default values clearer.
 

Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py	2010-10-08 20:04:31 UTC (rev 3951)
+++ base/trunk/mpulsweb/controllers/evaluate.py	2010-10-08 20:08:05 UTC (rev 3952)
@@ -80,8 +80,8 @@
                 options[name] = soptions[name]
 
     # convert dates to locale
-    options['start_date'] = format_date(options['start_date'])
-    options['end_date'] = format_date(options['end_date'])
+    options['start_date'] = options['start_date']
+    options['end_date'] = options['end_date']
     return options
 
 
@@ -113,8 +113,9 @@
             pass
 
         c.phases = PhaseFactory().build() 
+        defaults = EvaluationFormValidator().from_python(evaloptions)
         form = render('/evaluation/evaluate.mako')
-        return formencode.htmlfill.render(form, defaults=evaloptions,
+        return formencode.htmlfill.render(form, defaults=defaults,
                                           errors={}, auto_insert_errors=False)
 
     def _get_evalparams(self, form_result):



More information about the Mpuls-commits mailing list