[Mpuls-commits] r2119 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 24 15:55:50 CET 2010


Author: torsten
Date: 2010-03-24 15:55:49 +0100 (Wed, 24 Mar 2010)
New Revision: 2119

Modified:
   wasko/branches/2.0/mpulsweb/model/case.py
Log:
 mpulsweb/model/case.py (MpulsCase.getState), 
	  mpulsweb/model/case.py (MpulsCase.setState), 
	  mpulsweb/model/case.py (MpulsCase.getSessionCase): New copied from
	  jmdweb.


Modified: wasko/branches/2.0/mpulsweb/model/case.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/case.py	2010-03-24 14:51:17 UTC (rev 2118)
+++ wasko/branches/2.0/mpulsweb/model/case.py	2010-03-24 14:55:49 UTC (rev 2119)
@@ -642,6 +642,29 @@
         # Ensurse consistence of the case
         self.make_consistent()
 
+    def getState(self):
+        return self.state
+
+    def setState(self, value):
+        self.state.setState(value)
+
+    def getSessionCase(self):
+        """Return a SessionCase object initialized from the current case"""
+        fields = dict()
+        for field in self.get_session_fields():
+            # FIXME: Ideally we would use
+            # self.get_value(field.name) to get the value.  We use
+            # getattr instead because this compatibility layer
+            # translates None values into strings which some code
+            # (e.g. buildInfofield in
+            # templates/casemanagement/main.mako) relies on.
+            fields[field.alias] = getattr(self, field.alias)
+        signed = self.getPrivacyStatement().isSigned()
+        return SessionCase(self.id, state=self.state,
+                           privacy_statement=signed,
+                           **fields)
+
+
     def getStandin(self):
         """Returns the standin of the case"""
         if not self.standin is None:



More information about the Mpuls-commits mailing list