[Mpuls-commits] r1680 - in wasko/branches/2.0: . mpulsweb/model waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 22 18:38:27 CET 2010


Author: bh
Date: 2010-02-22 18:38:25 +0100 (Mon, 22 Feb 2010)
New Revision: 1680

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/model/case.py
   wasko/branches/2.0/waskaweb/controllers/case.py
Log:
* waskaweb/controllers/case.py (CaseController.newAction):
Sanitize the form_result with convert2dic when passing it to
createNew.

* mpulsweb/model/case.py (MpulsCaseFactory._updateMasterOnCreate):
Do not call convert2dic here.  Expect the data to be already
sanitized.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-22 17:17:25 UTC (rev 1679)
+++ wasko/branches/2.0/ChangeLog	2010-02-22 17:38:25 UTC (rev 1680)
@@ -1,5 +1,15 @@
 2010-02-22  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/controllers/case.py (CaseController.newAction):
+	Sanitize the form_result with convert2dic when passing it to
+	createNew.
+
+	* mpulsweb/model/case.py (MpulsCaseFactory._updateMasterOnCreate):
+	Do not call convert2dic here.  Expect the data to be already
+	sanitized.
+
+2010-02-22  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/controllers/case.py: Rearrange imports
 
 2010-02-22  Bernhard Herzog  <bh at intevation.de>

Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-02-22 17:17:25 UTC (rev 1679)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-02-22 17:38:25 UTC (rev 1680)
@@ -39,9 +39,7 @@
 from mpulsweb.lib.helpers import ensure_unicode
 from mpulsweb.lib.db import PostgresDBInterface, db
 
-from mpulsweb.controllers.formularpage import convert2dic
 
-
 log = logging.getLogger(__name__)
 
 
@@ -382,17 +380,15 @@
     def _updateMasterOnCreate(self, instance_tree, data):
         id = instance_tree.getRootNode().getIdentifier()
         try:
-            form_result = convert2dic(data)
-
-            data = {}
+            formed_data = {}
             nkey = None
-            for key, value in form_result.iteritems():
+            for key, value in data.iteritems():
                 nkey = get_field_identifier(id, key, instance_tree)
                 if not nkey:
                     continue
-                data[nkey] = value
+                formed_data[nkey] = value
 
-            instance_tree.setData(data)
+            instance_tree.setData(formed_data)
 
             session['uncommitted_fields'] = instance_tree.commit()
             session.save()

Modified: wasko/branches/2.0/waskaweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-22 17:17:25 UTC (rev 1679)
+++ wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-22 17:38:25 UTC (rev 1680)
@@ -48,7 +48,7 @@
 from mpulsweb.model.appointment import CaseAppointmentFactory
 from mpulsweb.model.logbook import LogbookEntry
 
-from mpulsweb.controllers.formularpage import get_rendered_page
+from mpulsweb.controllers.formularpage import convert2dic, get_rendered_page
 
 from waskaweb.lib.base import BaseController
 from waskaweb.lib.search import INCONSISTENCY_CHECK_AFTER
@@ -340,7 +340,7 @@
                     return render('/casemanagement/neuaufnahme.mako')
 
                 # 1. Create a new case
-                case = g.case_factory.createNew(data=form_result)
+                case = g.case_factory.createNew(data=convert2dic(form_result))
                 statement = case.getPrivacyStatement()
 
                 # 2. Do we want to sign the statement?



More information about the Mpuls-commits mailing list