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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 29 13:58:42 CET 2010


Author: torsten
Date: 2010-12-29 13:58:41 +0100 (Wed, 29 Dec 2010)
New Revision: 4462

Modified:
   base/trunk/mpulsweb/controllers/evaluate.py
Log:
* mpulsweb/controllers/evaluate.py (EvaluateController.reset_filter):
Delete id_field when resetting evalaution (search) filters.
* mpulsweb/controllers/evaluate.py
(EvaluateController._get_evalparams): Build selected ids-clause using
if_field.



Modified: base/trunk/mpulsweb/controllers/evaluate.py
===================================================================
--- base/trunk/mpulsweb/controllers/evaluate.py	2010-12-29 12:20:32 UTC (rev 4461)
+++ base/trunk/mpulsweb/controllers/evaluate.py	2010-12-29 12:58:41 UTC (rev 4462)
@@ -48,10 +48,11 @@
     return sdate, edate
 
 
-def get_search_options(soptions=None, id=None, selected_ids=()):
+def get_search_options(soptions=None, id=None, selected_ids=(), id_field=None):
     options = {}
     options['id'] = id
     options["selected_ids"] = " ".join(map(unicode, selected_ids))
+    options["id_field"] = id_field 
     options['typelist'] = c.evalconfig.get_evaluations()
 
     # set default evaluation options.
@@ -81,14 +82,17 @@
     def reset_filter(self, id):
         if session.has_key("evaluation_ids"):
             del session['evaluation_ids']
-            session.save()
+        if session.has_key("id_field"):
+            del session['id_field']
+        session.save()
         return self.evaluate(id)
 
     def evaluate(self, id=None):
         c.evalconfig = EvaluationConfig(get_configfile(id), None, None, None,
                                         None, None, None, None, None)
         evaloptions = get_search_options(session.get('evaluation.options'), id,
-                                         session.get("evaluation_ids", ()))
+                                         session.get("evaluation_ids",()), 
+                                         session.get("id_field"))
 
         # If user selects adele-evaluation render page with disabled
         # configuration elements.  Change default params
@@ -149,9 +153,10 @@
         where_clauses.append("".join(dates))
 
         selected_ids = "TRUE"
+        id_field = form_result.get("id_field")
         if form_result.get("selected_ids"):
-            selected_ids = ("(m.id in (%s))"
-                            % (",".join(map(str, form_result["selected_ids"]))))
+            selected_ids = ("(%s in (%s))"
+                            % (id_field, ",".join(map(str, form_result["selected_ids"]))))
 
         where_clauses.append(selected_ids)
 



More information about the Mpuls-commits mailing list