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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 17 15:23:08 CET 2009


Author: teichmann
Date: 2009-03-17 15:23:04 +0100 (Tue, 17 Mar 2009)
New Revision: 381

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/casedocument.py
Log:
Fixed bugs with old values in data save


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-17 14:08:54 UTC (rev 380)
+++ wasko/trunk/ChangeLog.txt	2009-03-17 14:23:04 UTC (rev 381)
@@ -1,5 +1,9 @@
 2009-03-17	Sascha L. Teichmann	<teichmann at intevation.de>
 
+	* waskaweb/model/casedocument.py: Fixed bugs with old values.
+
+2009-03-17	Sascha L. Teichmann	<teichmann at intevation.de>
+
 	* waskaweb/model/casedocument.py: Write back the simulation results.
 
 2009-03-17	Sascha L. Teichmann	<teichmann at intevation.de>

Modified: wasko/trunk/waskaweb/model/casedocument.py
===================================================================
--- wasko/trunk/waskaweb/model/casedocument.py	2009-03-17 14:08:54 UTC (rev 380)
+++ wasko/trunk/waskaweb/model/casedocument.py	2009-03-17 14:23:04 UTC (rev 381)
@@ -338,18 +338,14 @@
             ds_id = case.id
 
         for page_name, params in param_pages.items():
-            print >> sys.stderr, "%s: %s" % (page_name, repr(params))
             ps = self.getPageStore(page_name, ds_id)
 
             converted, delete_vars = {}, []
             for k, v in params.iteritems():
-                print >> sys.stderr, "k: %s" % k, "v: %s" % v
                 if v == "": # no value -> delete it
-                    print >> sys.stderr, "delete"
                     if ps.getData(k) != None: # NULL already?
                         delete_vars.append(k)
                 else:
-                    print >> sys.stderr, "try convert"
                     widget = self.widgets[k]
                     try:
                         nv = checkAndConvert(widget, v)
@@ -359,7 +355,6 @@
                         not_converted.append((key, value))
 
             param_pages[page_name] = (converted, delete_vars)
-            print repr(param_pages[page_name])
 
         if not_converted:
             raise DataSaveException(
@@ -380,10 +375,10 @@
                 try:
                     rules = self.var2rules[k]
                 except KeyError: # no rules
-                    print >> sys.stderr, "keine regel fuer %s" % k 
                     simulation[k] = v
                     continue
 
+                simulation_succeed = True
                 for rule in rules:
                     mark = rule.getMark()
                     if mark and mark.find("warning:") >= 0 or mark.find("notice:") >= 0:
@@ -394,9 +389,9 @@
                     isNull = False
                     for dep in expr.getDependencies():
                         if dep != k: 
-                            v = getValue(k)
-                            if v is None: isNull = True; break
-                            vars[dep] = v
+                            ov = getValue(k)
+                            if ov is None: isNull = True; break
+                            vars[dep] = ov
                     if isNull:
                         simulation[k] = v
                     else:
@@ -406,12 +401,13 @@
                         except:
                             okay = False
                         if not okay:
+                            simulation_succeed = False
                             not_converted.append((k, rule.getValue()))
-                        else:
-                            simulation[k] = v
 
+                if simulation_succeed:
+                    simulation[k] = v
+
             # only write back the minimal changeset
-            print >> sys.stderr,  "simulation: %s" % repr(simulation)
             param_pages[page_name] = simulation
 
         if not_converted:
@@ -421,7 +417,6 @@
         # third step: write back the changes:
         for page_name, params in param_pages.iteritems():
             if not params: continue
-            print >> sys.stderr, repr(params)
             ps = self.getPageStore(page_name, ds_id)
             for k, v in params.iteritems():
                 ps.setData(k, v)



More information about the Mpuls-commits mailing list