[Mpuls-commits] r1997 - wasko/branches/2.0/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 18 12:35:47 CET 2010


Author: torsten
Date: 2010-03-18 12:35:47 +0100 (Thu, 18 Mar 2010)
New Revision: 1997

Modified:
   wasko/branches/2.0/mpulsweb/controllers/case_overview.py
Log:
* mpulsweb/controllers/case_overview.py: parsing SearchOptions is now
  a standalone function (needs to be imported from else too)


Modified: wasko/branches/2.0/mpulsweb/controllers/case_overview.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case_overview.py	2010-03-18 11:33:18 UTC (rev 1996)
+++ wasko/branches/2.0/mpulsweb/controllers/case_overview.py	2010-03-18 11:35:47 UTC (rev 1997)
@@ -22,6 +22,36 @@
     order = params.get('sort_order', 'asc')
     return sort, order
 
+def parseSearchOptions(options):
+    search_options = []
+    user = session['USER_AUTHORIZED']
+
+    # Searchstring 
+    if options.get('search_str'):
+        search_options.append(options.get('search_str'))
+
+    # Status
+    if options.has_key('state'):
+        for s in options['state']:
+            search_options.append('state:%s' % s)
+
+    # Responsibilty 
+    # (shown cases where the user is editor, or standin or both)
+    if options.get('own'):
+            search_options.append('own:%s' % user.id)
+    if options.get('standin'):
+            search_options.append('standin:%s' % user.id)
+
+    # Phase
+    if options.has_key('phase'):
+        for pp in options['phase']:
+            log.debug(pp)
+            # Get phasepart ids for the selected phasepairs.
+            for p in g.mpuls_config.get('phases', 'pairs')[0].get(str(pp), [-1]):
+                search_options.append('phase:%s' % p)
+
+    return search_options
+
 class CaseOverviewController(BaseController):
 
     @checkRole(('admin', 'cm', 'pt_dlr'))
@@ -137,33 +167,6 @@
         return search_options
 
     def parseSearchOptions(self, options=None):
-        search_options = []
-        user = session['USER_AUTHORIZED']
+        return parseSearchOptions(options)
 
-        # Searchstring 
-        if options.get('search_str'):
-            search_options.append(options.get('search_str'))
-
-        # Status
-        if options.has_key('state'):
-            for s in options['state']:
-                search_options.append('state:%s' % s)
-
-        # Responsibilty 
-        # (shown cases where the user is editor, or standin or both)
-        if options.get('own'):
-                search_options.append('own:%s' % user.id)
-        if options.get('standin'):
-                search_options.append('standin:%s' % user.id)
-
-        # Phase
-        if options.has_key('phase'):
-            for pp in options['phase']:
-                log.debug(pp)
-                # Get phasepart ids for the selected phasepairs.
-                for p in g.mpuls_config.get('phases', 'pairs')[0].get(str(pp), [-1]):
-                    search_options.append('phase:%s' % p)
-
-        return search_options
-
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:



More information about the Mpuls-commits mailing list