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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 10 12:06:16 CEST 2010


Author: torsten
Date: 2010-08-10 12:06:15 +0200 (Tue, 10 Aug 2010)
New Revision: 3353

Modified:
   base/trunk/mpulsweb/controllers/case_overview.py
Log:
* mpulsweb/controllers/case_overview.py (parseSearchOptions): Only add
	  dates to search string if user provides start and end date.
	* mpulsweb/controllers/case_overview.py
	(CaseOverviewController.overview): Added errors to htmlfill.
	* mpulsweb/controllers/case_overview.py
	(CaseOverviewController.overview): Removed poping values with errors
	from session. We need the value to be displayed with the error
	message.


Modified: base/trunk/mpulsweb/controllers/case_overview.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_overview.py	2010-08-10 10:03:42 UTC (rev 3352)
+++ base/trunk/mpulsweb/controllers/case_overview.py	2010-08-10 10:06:15 UTC (rev 3353)
@@ -83,7 +83,10 @@
             for p in pairs[0].get(str(pp), [-1]):
                 search_options.append('phase:%s' % p)
     # Dates 
-    if options.has_key('sdate') and options.has_key('edate'):
+    if (options.has_key('sdate') 
+        and options.has_key('edate') 
+        and options.get('sdate') is not None 
+        and options.get('edate') is not None):
         search_options.append('sdate:%s' % options.get('sdate'))
         search_options.append('edate:%s' % options.get('edate'))
 
@@ -178,7 +181,8 @@
         
         formular_defaults = form_defaults_copy or request.params.mixed()
         return formencode.htmlfill.render(overview,
-                                          defaults=formular_defaults)
+                                          defaults=formular_defaults,
+                                          errors=c.form_errors)
 
 
     @checkRole(('admin', 'cm', 'pt_dlr'))
@@ -193,13 +197,6 @@
             c.form_result = error.value
             c.form_errors = error.error_dict or {}
 
-        # Dont save in the session values with errors
-        if c.form_errors != {}:
-            form_results_copy = c.form_result.copy()
-            for key in form_results_copy:
-                if key in c.form_errors:
-                    c.form_result.pop(key)
-        
         session['CASE_OVERVIEW_SEARCHOPTIONS'] = c.form_result
         session.save()
         return self.overview()



More information about the Mpuls-commits mailing list