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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 17 10:51:44 CET 2009


Author: teichmann
Date: 2009-03-17 10:51:41 +0100 (Tue, 17 Mar 2009)
New Revision: 374

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/casedocument.py
Log:
Added a setData() method to case formed document.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-16 14:39:21 UTC (rev 373)
+++ wasko/trunk/ChangeLog.txt	2009-03-17 09:51:41 UTC (rev 374)
@@ -1,5 +1,10 @@
 2009-03-16	Sascha L. Teichmann	<teichmann at intevation.de>
 
+	* waskaweb/model/casedocument.py: Added a setData() method. Not
+	  functional yet.
+
+2009-03-16	Sascha L. Teichmann	<teichmann at intevation.de>
+
 	* waskaweb/model/exprtree.py: Forgot to call today with context.
 
 2009-03-16	Sascha L. Teichmann	<teichmann at intevation.de>

Modified: wasko/trunk/waskaweb/model/casedocument.py
===================================================================
--- wasko/trunk/waskaweb/model/casedocument.py	2009-03-16 14:39:21 UTC (rev 373)
+++ wasko/trunk/waskaweb/model/casedocument.py	2009-03-17 09:51:41 UTC (rev 374)
@@ -302,4 +302,28 @@
             okay = False
         return okay
 
-# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+    def setData(self, params, ds_id = None):
+        if ds_id is None:
+            case = session.get('case')
+            if not case: return None
+            ds_id = case.id
+
+        # assign params to their pages
+        param_pages = {}
+
+        for k, v in params.iteritems():
+            try:
+                page_name = self.widgets2pages[k]
+            except KeyError:
+                print >> sys.stderr, "cannot find page for '%s'" % repr(k)
+                continue
+
+            try:
+                param_page = param_pages[page_name]
+            except KeyError:
+                param_page = {}
+                param_pages[page_name] = param_page
+
+            param_page[k] = v
+
+# vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :



More information about the Mpuls-commits mailing list