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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 8 09:55:34 CEST 2010


Author: torsten
Date: 2010-09-08 09:55:33 +0200 (Wed, 08 Sep 2010)
New Revision: 3552

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCaseFactory.loadById): Issue1112: Init case with loaded tags. LOAD_CASE_SQL: Load tags when loading case.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-09-07 16:58:46 UTC (rev 3551)
+++ base/trunk/mpulsweb/model/case.py	2010-09-08 07:55:33 UTC (rev 3552)
@@ -62,7 +62,7 @@
 log = logging.getLogger(__name__)
 
 
-LOAD_CASE_SQL = """SELECT %(fields)s FROM master_tbl_view WHERE id = %%(id)s"""
+LOAD_CASE_SQL = """SELECT %(fields)s, ARRAY(SELECT tag_id FROM nm_tags_cases_view WHERE case_id = %%(id)s) AS tags FROM master_tbl_view WHERE id = %%(id)s"""
 
 #SQL
 LOAD_STANDIN_SQL = """
@@ -524,6 +524,7 @@
         self.standin = None
         self.documents = []
         self.appointments = []
+        print "Tags: %s" % tags
         self.tags = tags
         self.privacy_statement = None
         #self.digest = None (TODO: Seems not to be used)
@@ -1041,7 +1042,7 @@
         finally:
             db.recycleConnection(conn, c)
 
-        return self.case_cls(id, preset=self._build_preset(result))
+        return self.case_cls(id, preset=self._build_preset(result), tags=result['tags'])
 
     def loadFromQueryResult(self, result):
         """Create a Case object from a DB query result row.



More information about the Mpuls-commits mailing list