[Mpuls-commits] r2596 - wasko/branches/2.0/jmdweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 3 14:06:40 CEST 2010


Author: torsten
Date: 2010-05-03 14:06:35 +0200 (Mon, 03 May 2010)
New Revision: 2596

Modified:
   wasko/branches/2.0/jmdweb/controllers/case.py
Log:
* jmdweb/controllers/case.py (CaseController.newAction): write
	additional fields (adressdata) to the case on creation.


Modified: wasko/branches/2.0/jmdweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/jmdweb/controllers/case.py	2010-05-03 11:12:42 UTC (rev 2595)
+++ wasko/branches/2.0/jmdweb/controllers/case.py	2010-05-03 12:06:35 UTC (rev 2596)
@@ -70,10 +70,24 @@
             try:
                 form_result = validator.to_python(request.params)
                 # 1. Create a new case
-                case = g.case_factory.createNew(data=convert2dic(form_result))
+                case = g.case_factory.createNew(data=convert2dic({}))
+                case._load_formed_instance_tree()
+                # Set data
+                data = {}
+                for k in convert2dic(form_result).keys():
+                    try:
+                        item = case.formed_instance.getAllItemsForName(k)[0]
+                        id = ":".join(item.getIdentifier().split(':')[1:])
+                        data["%s:%s" % (k,id)] = form_result.get(k) 
+                    except:
+                        # some values within the formresult can not be found in
+                        # instance tree. e.g "statement_signed"
+                        pass
+                case.formed_instance.setData(data)
+                case.formed_instance.commit()
+
                 statement = case.getPrivacyStatement()
-
-                # 2. Do we want to sign the statement?
+                # 3. Do we want to sign the statement?
                 if form_result.get('statement_signed'):
                     statement.sign()
 



More information about the Mpuls-commits mailing list