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

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


Author: bh
Date: 2010-08-16 17:56:47 +0200 (Mon, 16 Aug 2010)
New Revision: 3414

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/controllers/case_overview.py
Log:
* mpulsweb/controllers/case_overview.py (get_sort): Refactor a
little to avoid some duplications


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-08-16 15:53:13 UTC (rev 3413)
+++ base/trunk/ChangeLog	2010-08-16 15:56:47 UTC (rev 3414)
@@ -1,5 +1,10 @@
 2010-08-16  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/case_overview.py (get_sort): Refactor a
+	little to avoid some duplications
+
+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)

Modified: base/trunk/mpulsweb/controllers/case_overview.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_overview.py	2010-08-16 15:53:13 UTC (rev 3413)
+++ base/trunk/mpulsweb/controllers/case_overview.py	2010-08-16 15:56:47 UTC (rev 3414)
@@ -21,14 +21,17 @@
     and order. If user does not provide one of there params, try to return the
     safed params in session. If session is also empty return default params.
     '''
-    sort = params.get('sort_field', 
-                      session['CASE_OVERVIEW_SEARCHOPTIONS'].get('sort_field', 
-                      g.mpuls_config.get('search', 'default-sorting')))
-    order = params.get('sort_order', 
-                      session['CASE_OVERVIEW_SEARCHOPTIONS'].get('sort_order',
-                      g.mpuls_config.get('search', 'default-order')))
-    session['CASE_OVERVIEW_SEARCHOPTIONS']['sort_field'] = sort 
-    session['CASE_OVERVIEW_SEARCHOPTIONS']['sort_order'] = order
+    session_options = session['CASE_OVERVIEW_SEARCHOPTIONS']
+    sort = params.get('sort_field',
+                      session_options.get('sort_field',
+                                          g.mpuls_config.get('search',
+                                                            'default-sorting')))
+    order = params.get('sort_order',
+                       session_options.get('sort_order',
+                                           g.mpuls_config.get('search',
+                                                              'default-order')))
+    session_options['sort_field'] = sort
+    session_options['sort_order'] = order
     session.save()
     return sort, order
 



More information about the Mpuls-commits mailing list