[Mpuls-commits] r3792 - in wasko/trunk: . waskoweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Sep 27 17:06:56 CEST 2010


Author: bh
Date: 2010-09-27 17:06:56 +0200 (Mon, 27 Sep 2010)
New Revision: 3792

Modified:
   wasko/trunk/ChangeLog
   wasko/trunk/waskoweb/controllers/formularpage.py
Log:
* waskoweb/controllers/formularpage.py (FormularpageController.save)
(FormularpageController._handle_evaluation_number): Move the
evaluation number handling code from the save method into the new
method _handle_evaluation_number.


Modified: wasko/trunk/ChangeLog
===================================================================
--- wasko/trunk/ChangeLog	2010-09-27 14:48:26 UTC (rev 3791)
+++ wasko/trunk/ChangeLog	2010-09-27 15:06:56 UTC (rev 3792)
@@ -1,5 +1,12 @@
 2010-09-27  Bernhard Herzog  <bh at intevation.de>
 
+	* waskoweb/controllers/formularpage.py (FormularpageController.save)
+	(FormularpageController._handle_evaluation_number): Move the
+	evaluation number handling code from the save method into the new
+	method _handle_evaluation_number.
+
+2010-09-27  Bernhard Herzog  <bh at intevation.de>
+
 	* waskoweb/controllers/formularpage.py
 	(FormularpageController.save): Use the base class method
 	_check_case_validity for the validity chec.  The inline code for

Modified: wasko/trunk/waskoweb/controllers/formularpage.py
===================================================================
--- wasko/trunk/waskoweb/controllers/formularpage.py	2010-09-27 14:48:26 UTC (rev 3791)
+++ wasko/trunk/waskoweb/controllers/formularpage.py	2010-09-27 15:06:56 UTC (rev 3792)
@@ -71,9 +71,6 @@
         # Save the request parameters for later use
         form_result = convert2dic(request.params)
         
-        """
-        Generate the evaluation ID
-        """
         factory = InstanceFactory(g.formedTree, PostgresDBInterface())
         instance_tree = factory.loadInstanceTreeByIdentifier(
             session['case'].id,
@@ -84,24 +81,7 @@
             apply_hidden_booleans(form_result)
 
             # Special logic for the Evaluation-ID
-            if request.params['page'].split(':')[0] == 'page-2':
-                
-                # Reset the evaluation number is the young adult does not want
-                # to participate in the survey or does not want his personal
-                # data to be used
-                if form_result['teilnahme_evaluation:%s' % case_id] in \
-                [u'-1', u'1', u'3', u'4', u'5']:
-                    form_result['evaluation_nummer:%s' % case_id] = u''
-                
-                # The evaluation_nummer field might be grayed out, so it won't
-                # be in the sent fields dictionary
-                elif 'evaluation_nummer:%s' % case_id not in form_result:
-                    agency = Agency()
-                    # Generate the ID (we do not check for uniqueness). It is
-                    # created from the evaluation abbreviation (agency wide) and
-                    # a manually entered number or sequence
-                    form_result['evaluation_nummer:%s' % case_id] = \
-                        u"%s-(bitte ergaenzen)" % (agency.getEvaluationId())
+            self._handle_evaluation_number(case_id, form_result)
             
             instance_tree.setData(form_result)
             session['uncommited_fields'] = instance_tree.commit()
@@ -221,3 +201,25 @@
             return phase_changed
 
         return self.select(page_id)
+
+    def _handle_evaluation_number(self, case_id, form_result):
+        """Set or Reset the evaluation number if the form_result is for page 2
+        """
+        if request.params['page'].split(':')[0] == 'page-2':
+
+            # Reset the evaluation number is the young adult does not want
+            # to participate in the survey or does not want his personal
+            # data to be used
+            if form_result['teilnahme_evaluation:%s' % case_id] in \
+            [u'-1', u'1', u'3', u'4', u'5']:
+                form_result['evaluation_nummer:%s' % case_id] = u''
+
+            # The evaluation_nummer field might be grayed out, so it won't
+            # be in the sent fields dictionary
+            elif 'evaluation_nummer:%s' % case_id not in form_result:
+                agency = Agency()
+                # Generate the ID (we do not check for uniqueness). It is
+                # created from the evaluation abbreviation (agency wide) and
+                # a manually entered number or sequence
+                form_result['evaluation_nummer:%s' % case_id] = \
+                    u"%s-(bitte ergaenzen)" % (agency.getEvaluationId())



More information about the Mpuls-commits mailing list