[Mpuls-commits] r399 - in wasko/trunk: . waskaweb/controllers waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 18 14:23:05 CET 2009


Author: torsten
Date: 2009-03-18 14:23:02 +0100 (Wed, 18 Mar 2009)
New Revision: 399

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/caselifetime.py
   wasko/trunk/waskaweb/model/datapage.py
Log:
Fixed coping of casedata


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-18 12:37:11 UTC (rev 398)
+++ wasko/trunk/ChangeLog.txt	2009-03-18 13:23:02 UTC (rev 399)
@@ -1,3 +1,11 @@
+2009-03-18	Torsten Irlaender  <torsten.irlaender at intevation.de> 
+
+	Fixed coping of casedata
+
+	* waskaweb/model/datapage.py,
+	  waskaweb/controllers/caselifetime.py: Fixed SQL Update query and
+	  typo in function call. 
+
 2009-03-18	Sascha L. Teichmann <teichmann at intevation.de>
 
 	* waskaweb/model/datapage.py: New class DataExtractor to extract

Modified: wasko/trunk/waskaweb/controllers/caselifetime.py
===================================================================
--- wasko/trunk/waskaweb/controllers/caselifetime.py	2009-03-18 12:37:11 UTC (rev 398)
+++ wasko/trunk/waskaweb/controllers/caselifetime.py	2009-03-18 13:23:02 UTC (rev 399)
@@ -57,8 +57,8 @@
 
 def extract_data_from_case(case_id = None):
 
-    phase_a = g.formedTree.findbyName('phase-a')
-    phase_b = g.formedTree.findbyName('phase-b')
+    phase_a = g.formedTree.findByName('phase-a')
+    phase_b = g.formedTree.findByName('phase-b')
 
     collector = WidgetCollector()
 
@@ -235,14 +235,13 @@
         if confirmed == '1':
             data = {}
             # copy old data. fetch all fields from PHASE A and PHASE B but ignore some
-
-            # for field in fieldsOfPhaseA and fieldsOfPhaseB:
-            #     if field not in (nottocopyfields):
-            #         data[field] = c.casedata.getData(field, '')
+            old_fields = extract_data_from_case()
+            print old_fields.data
             try:
-                # create new case
+                # create new case and store fields form the old case in the new case
                 factory = CaseFactory()
                 case = factory.createNew(data={})
+                old_fields.storeData(case.id)
 
                 # Füge alte params aus dem Dialog in der verwaltung hinzu und
                 # schreib in den neuen Fall

Modified: wasko/trunk/waskaweb/model/datapage.py
===================================================================
--- wasko/trunk/waskaweb/model/datapage.py	2009-03-18 12:37:11 UTC (rev 398)
+++ wasko/trunk/waskaweb/model/datapage.py	2009-03-18 13:23:02 UTC (rev 399)
@@ -306,7 +306,7 @@
         try:
             con = db.getConnection()
             cur = con.cursor()
-            select = "SELECT %s FROM master_tbl_view WHERE id = %%(ds_id)" % \
+            select = "SELECT %s FROM master_tbl_view WHERE id = %%(ds_id)s" % \
                 ", ".join(keys)
             cur.execute(select, { 'ds_id': ds_id })
             row = cur.fetchone()
@@ -325,7 +325,9 @@
         try:
             con = db.getConnection()
             cur = con.cursor()
-            cur.execute(update, { 'ds_id': ds_id })
+            values = self.data or {}
+            values['ds_id'] = ds_id
+            cur.execute(update, values)
             con.commit()
         finally:
             db.recycleConnection(con, cur)



More information about the Mpuls-commits mailing list