[Mpuls-commits] r384 - in wasko/trunk: . waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 17 17:59:48 CET 2009
Author: teichmann
Date: 2009-03-17 17:59:46 +0100 (Tue, 17 Mar 2009)
New Revision: 384
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/model/casedocument.py
Log:
Added "do_write" parameter to setData() method in case formed document.
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-03-17 14:55:32 UTC (rev 383)
+++ wasko/trunk/ChangeLog.txt 2009-03-17 16:59:46 UTC (rev 384)
@@ -1,5 +1,12 @@
2009-03-17 Sascha L. Teichmann <teichmann at intevation.de>
+ * waskaweb/model/casedocument.py: Error are now report in form
+ of lists of tuples (<name of item>, <invalid value from web>, <error desc>).
+ setData() has now a 'do_write' parameter (default: True). when set
+ the data is written back to DB.
+
+2009-03-17 Sascha L. Teichmann <teichmann at intevation.de>
+
* waskaweb/model/casedocument.py: Fixed bug with rule evaluation
in save data.
Modified: wasko/trunk/waskaweb/model/casedocument.py
===================================================================
--- wasko/trunk/waskaweb/model/casedocument.py 2009-03-17 14:55:32 UTC (rev 383)
+++ wasko/trunk/waskaweb/model/casedocument.py 2009-03-17 16:59:46 UTC (rev 384)
@@ -310,7 +310,10 @@
okay = False
return okay
- def setData(self, params, ds_id = None):
+ def setData(self, params, ds_id = None, do_write = True):
+
+ orig_params = params
+
# assign params to their pages
param_pages = {}
@@ -352,7 +355,7 @@
if nv != ps.getData(k): # only if it's a change
converted[k] = nv
except SematicError, inst:
- not_converted.append((key, value))
+ not_converted.append((key, v, inst.value))
param_pages[page_name] = (converted, delete_vars)
@@ -401,7 +404,7 @@
okay = False
if not okay:
simulation_succeed = False
- not_converted.append((k, rule.getValue()))
+ not_converted.append((k, orig_params[k], rule.getValue()))
if simulation_succeed:
simulation[k] = v
@@ -413,12 +416,13 @@
raise DataSaveException(
"Datenkonsistenz nicht eingehalten", not_converted)
- # third step: write back the changes:
- for page_name, params in param_pages.iteritems():
- if not params: continue
- ps = self.getPageStore(page_name, ds_id)
- for k, v in params.iteritems():
- ps.setData(k, v)
- ps.store()
+ if do_write:
+ # third step: write back the changes:
+ for page_name, params in param_pages.iteritems():
+ if not params: continue
+ ps = self.getPageStore(page_name, ds_id)
+ for k, v in params.iteritems():
+ ps.setData(k, v)
+ ps.store()
# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
More information about the Mpuls-commits
mailing list