[Mpuls-commits] r6145 - wasko/trunk/waskoweb/controllers

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 7 17:26:11 CET 2012


Author: torsten
Date: 2012-12-07 17:26:11 +0100 (Fri, 07 Dec 2012)
New Revision: 6145

Modified:
   wasko/trunk/waskoweb/controllers/evaluate.py
Log:
Added adele specific code


Modified: wasko/trunk/waskoweb/controllers/evaluate.py
===================================================================
--- wasko/trunk/waskoweb/controllers/evaluate.py	2012-12-05 11:22:03 UTC (rev 6144)
+++ wasko/trunk/waskoweb/controllers/evaluate.py	2012-12-07 16:26:11 UTC (rev 6145)
@@ -1,5 +1,8 @@
+from pylons import session, g
 from mpulsweb.controllers.evaluate import \
-     EvaluateController as MpulsEvaluateController
+     EvaluateController as MpulsEvaluateController, \
+     get_common_options, get_session_options, \
+     get_default_options
 
 class EvaluateController(MpulsEvaluateController):
 
@@ -13,3 +16,25 @@
                     ", ".join([str(e) for e in params['type_ending']])))
         else:
             return "TRUE"
+
+    def get_default_adele_options(self):
+        """Return a dictionary with the default evaluation options for 'adele'.
+        It has the same contents as the one returned by
+        get_default_options() except for the phase which is taken from the
+        'evaluations', 'adele-phases' configuration option.
+        """
+        options = get_default_options()
+        options["phase"] = g.mpuls_config.get('evaluations', 'adele-phases')
+        return options
+
+    def _get_options(self, id, evalconfig, session):
+        # If user selects adele-evaluation render page with different default
+        # options and no session options.
+        common_options = get_common_options(evalconfig, id,
+                                            session.get("evaluation_ids", ()))
+        if id == "0":
+            option_sources = [common_options, self.get_default_adele_options()]
+        else:
+            option_sources  = [get_default_options(), common_options,
+                               get_session_options()]
+        return option_sources



More information about the Mpuls-commits mailing list