[Mpuls-commits] r178 - in waska/trunk: . waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 19 16:48:24 CEST 2008


Author: teichmann
Date: 2008-09-19 16:48:23 +0200 (Fri, 19 Sep 2008)
New Revision: 178

Modified:
   waska/trunk/ChangeLog.txt
   waska/trunk/waskaweb/controllers/case.py
Log:
Fixed issue565


Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt	2008-09-19 14:05:33 UTC (rev 177)
+++ waska/trunk/ChangeLog.txt	2008-09-19 14:48:23 UTC (rev 178)
@@ -1,5 +1,12 @@
 2008-09-19  Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
+	Fixed issue565
+
+	* waskaweb/controllers/case.py: fetch "Erstgespraech" and "Kundennummer" from
+	  the FormEd data page which always contains the valid values.
+
+2008-09-19  Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
 	Fixed issue563
 
 	* waskaweb/templates/casemanagement/evaluation/evaluation_avg_effort.mako:

Modified: waska/trunk/waskaweb/controllers/case.py
===================================================================
--- waska/trunk/waskaweb/controllers/case.py	2008-09-19 14:05:33 UTC (rev 177)
+++ waska/trunk/waskaweb/controllers/case.py	2008-09-19 14:48:23 UTC (rev 178)
@@ -472,27 +472,28 @@
             except KeyError:
                 print >> sys.stderr, "Error! Could not update Infofield"
 
-        elif ti.page == "page_0":
-            try:
-                erstgespraech = request.params.getone("erstgespraech")
-                try:
-                    d,m,y = erstgespraech.split('.')
-                    case_session.first_meeting = date(int(y), int(m), int(d))
-                except:
-                    traceback.print_exc(file=sys.stderr)
-                    case_session.first_meeting = None
-                case_session.knr = request.params.getone("kundennummer")
-                session.save()
-            except KeyError:
-                print >> sys.stderr, "Error! Could not update Infofield"
         # Get old formerrors, save data and store new formdata
         old_errors = case_session.getFormErrors()
         ds_id = request.params["ds"]
-        new_errors = self.__save(ti.page, request.params.dict_of_lists(), old_errors, ti.realId(ds_id))
+        new_errors, page = self.__save(
+            ti.page, 
+            request.params.dict_of_lists(), 
+            old_errors, 
+            ti.realId(ds_id))
+
         if new_errors:
             c.status_msg = h.status_message("Eingabedaten fehlerhaft! Daten wurden nicht gespeichert.")
         else:
             c.status_msg = h.status_message(u'Daten erfolgreich gespeichert. Bitte beachten Sie die <a href="/case/showhelp/datenschutz_veraenderte_daten" target="_blank">Hinweise zur Datenschutz.</a>')
+
+        if ti.page == "page_0":
+            try:
+                case_session.first_meeting = h.dd_mm_YYYY(page.getData("erstgespraech"), None)
+                case_session.knr           = page.getData("kundennummer")
+            except:
+                traceback.print_exc(file=sys.stderr)
+            session.save()
+
         case_session.setFormErrors(new_errors)
         session.save()
 
@@ -521,12 +522,12 @@
         return self.edit(ds_id, ti.key) 
 
     def __save(self, pageName, params, old_errors, ds_id):
-
         # fetch dataset if valid
         document = g.formedTree
         page = document.getPageStore(pageName)
         page.setId(ds_id)
-        return page.save(params, old_errors, document)
+        result = page.save(params, old_errors, document)
+        return result, page
 
     @checkRole('cm_ka')
     def importCase(self):



More information about the Mpuls-commits mailing list