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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Aug 13 11:26:40 CEST 2010


Author: torsten
Date: 2010-08-13 11:26:39 +0200 (Fri, 13 Aug 2010)
New Revision: 3393

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCaseState.isCmFinished): Fixed
	function.
* mpulsweb/model/case.py (MpulsCaseState.get_formed_item): Make
	function public


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-08-13 08:00:26 UTC (rev 3392)
+++ base/trunk/mpulsweb/model/case.py	2010-08-13 09:26:39 UTC (rev 3393)
@@ -597,19 +597,19 @@
             factory = InstanceFactory(g.formedTree, PostgresDBInterface())
             self.formed_instance = factory.loadInstanceTreeByIdentifier(self.id)
 
-    def _get_formed_item(self, name):
+    def get_formed_item(self, name):
         self._load_formed_instance_tree()
         fid = get_field_identifier(self.id, name, self.formed_instance)
         if fid:
             return self.formed_instance.getItem(fid)
-        log.error('(_get_formed_item): Can not find %s' % name)
+        log.error('(get_formed_item): Can not find %s' % name)
         return None
 
     def get_description(self, name):
         """Return the description of the formed field given by name"""
         if self.formed_instance is None:
             self._load_formed_instance_tree()
-        item = self._get_formed_item(name)
+        item = self.get_formed_item(name)
         if item:
             return item.getMeta().getDescription()
         else:
@@ -633,7 +633,7 @@
         """
         # always use formed instance tree if available
         if self.formed_instance is not None:
-            item = self._get_formed_item(name)
+            item = self.get_formed_item(name)
             if item:
                 return item.getValue()
             else:
@@ -754,7 +754,7 @@
             # Fill all other fields with "unknown" values.
             for field in start.fields:
                 if data.has_key("%s" % (field.id)): continue
-                item = self._get_formed_item(field.name)
+                item = self.get_formed_item(field.name)
                 try:
                     value = item.getValue()
                     log.debug('Current value of %s: %s' % (field.id, value))
@@ -769,7 +769,7 @@
             for field in end.fields:
                 if data.has_key("%s" % (field.id)): continue
                 try:
-                    item = self._get_formed_item(field.name)
+                    item = self.get_formed_item(field.name)
                     value = item.getValue()
                     log.debug('Current value of %s: %s' % (field.id, value))
                     if item.getValue() in [-1, "-1", None, ""]:
@@ -1193,7 +1193,7 @@
         return state_labels.get(str(self.state))
 
     def isCmFinished(self):
-        return self.phase in g.mpuls_config.get('phases', 'finished')
+        return str(self.phase) in g.mpuls_config.get('phases', 'finished')
 
     def getState(self):
         return self.state



More information about the Mpuls-commits mailing list