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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 16 17:53:18 CEST 2010


Author: bh
Date: 2010-08-16 17:53:13 +0200 (Mon, 16 Aug 2010)
New Revision: 3413

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case_overview.py
Log:
* mpulsweb/controllers/case_overview.py (FORM_DEFAULTS_ADMIN)
(FORM_DEFAULTS_CM, FORM_DEFAULTS_SORT, FORM_DEFAULTS_ORDER):
Removed.  Global variables must not be initialized from
application specific data that may change on a per-request basis.
(get_sort, CaseOverviewController.overview): Get the information
formerly stored in the now removed FORM_* constants directly from
g.mpuls_config so that the value is always the one that belongs to
the active request.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-16 11:18:42 UTC (rev 3412)
+++ base/trunk/ChangeLog	2010-08-16 15:53:13 UTC (rev 3413)
@@ -1,5 +1,16 @@
 2010-08-16  Bernhard Herzog  <bh at intevation.de>
 
+	Fix mpuls/issue860, and part of mpuls/issue979:
+
+	* mpulsweb/controllers/case_overview.py (FORM_DEFAULTS_ADMIN)
+	(FORM_DEFAULTS_CM, FORM_DEFAULTS_SORT, FORM_DEFAULTS_ORDER):
+	Removed.  Global variables must not be initialized from
+	application specific data that may change on a per-request basis.
+	(get_sort, CaseOverviewController.overview): Get the information
+	formerly stored in the now removed FORM_* constants directly from
+	g.mpuls_config so that the value is always the one that belongs to
+	the active request.
+
 	* mpulsweb/templates/casemanagement/search.mako: Add for-attribute
 	to the label element for the "Unknown" phase checkbox so that one
 	can click on the label to toggle the checkbox

Modified: base/trunk/mpulsweb/controllers/case_overview.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_overview.py	2010-08-16 11:18:42 UTC (rev 3412)
+++ base/trunk/mpulsweb/controllers/case_overview.py	2010-08-16 15:53:13 UTC (rev 3413)
@@ -16,12 +16,6 @@
 log = logging.getLogger(__name__)
 
 
-FORM_DEFAULTS_ADMIN = g.mpuls_config.get('search', 'admin_defaults')[0]
-FORM_DEFAULTS_CM = g.mpuls_config.get('search', 'cm_defaults')[0]
-FORM_DEFAULTS_SORT = g.mpuls_config.get('search', 'default-sorting')
-FORM_DEFAULTS_ORDER = g.mpuls_config.get('search', 'default-order')
-
-
 def get_sort(params):
     '''Return sort field and sort order. First try to return a userdefined sort
     and order. If user does not provide one of there params, try to return the
@@ -29,10 +23,10 @@
     '''
     sort = params.get('sort_field', 
                       session['CASE_OVERVIEW_SEARCHOPTIONS'].get('sort_field', 
-                      FORM_DEFAULTS_SORT))
+                      g.mpuls_config.get('search', 'default-sorting')))
     order = params.get('sort_order', 
                       session['CASE_OVERVIEW_SEARCHOPTIONS'].get('sort_order',
-                      FORM_DEFAULTS_ORDER))
+                      g.mpuls_config.get('search', 'default-order')))
     session['CASE_OVERVIEW_SEARCHOPTIONS']['sort_field'] = sort 
     session['CASE_OVERVIEW_SEARCHOPTIONS']['sort_order'] = order
     session.save()
@@ -115,9 +109,9 @@
         # Set default paramaters for casesearch depending on userrole
         user = session['USER_AUTHORIZED']
         if user.isAdmin():
-            FORM_DEFAULTS = FORM_DEFAULTS_ADMIN
+            FORM_DEFAULTS = g.mpuls_config.get('search', 'admin_defaults')[0]
         else:
-            FORM_DEFAULTS = FORM_DEFAULTS_CM
+            FORM_DEFAULTS = g.mpuls_config.get('search', 'cm_defaults')[0]
 
         # If reset parameter is set ti != 0 the delete all saved params and
         # cases on overview page



More information about the Mpuls-commits mailing list