[Mpuls-commits] r4619 - base/trunk/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 15 12:42:45 CET 2011


Author: torsten
Date: 2011-02-15 12:42:45 +0100 (Tue, 15 Feb 2011)
New Revision: 4619

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCaseBundle.formletter): Added function
	to export the formletter on casebundles.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-02-15 11:41:08 UTC (rev 4618)
+++ base/trunk/mpulsweb/model/case.py	2011-02-15 11:42:45 UTC (rev 4619)
@@ -451,6 +451,17 @@
 
         return num, export
 
+    def formletter(self, letterid):
+        factory = g.case_factory
+        l = []
+        for id in self.case_list:
+            case = factory.loadById(id)
+            try:
+                l.append(case.formletter(letterid))
+            except Exception, e:
+                log.exception(e)
+        return l 
+
     def _exportXML(self, tree):
         root = tree.getroot()
         xml = ElementTree.tostring(root)
@@ -1022,6 +1033,7 @@
                 d = {'id': self.id}
                 for sql in letter.get('sql'):
                     cur.execute(sql, d)
+                    print cur.query
                     for k, v in cur.fetchone().iteritems():
                         fields[k] = v
             finally:



More information about the Mpuls-commits mailing list