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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 28 17:20:10 CEST 2010


Author: torsten
Date: 2010-07-28 17:20:08 +0200 (Wed, 28 Jul 2010)
New Revision: 3255

Modified:
   base/trunk/mpulsweb/model/case.py
Log:
* mpulsweb/model/case.py (MpulsCase.make_consistent): Except error and
ignore if the function tries to get Values from instance-nodes which
do not have Values (i.e Groupnodes) this happens mostly because of
misconfigured formedtrees where groupnodes are marked as required
fields.


Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2010-07-28 11:02:12 UTC (rev 3254)
+++ base/trunk/mpulsweb/model/case.py	2010-07-28 15:20:08 UTC (rev 3255)
@@ -750,23 +750,31 @@
             for field in start.fields:
                 if data.has_key("%s" % (field.id)): continue
                 item = self._get_formed_item(field.name)
-                value = item.getValue()
-                log.debug('Current value of %s: %s' % (field.id, value))
-                if value in [-1, "-1", None, ""]:
-                    def_value = get_unknown_value(item)
-                    if def_value:
-                        log.debug("Setting %s to %s" % (field.id, def_value))
-                        data["%s" % (field.id)] = def_value
+                try:
+                    value = item.getValue()
+                    log.debug('Current value of %s: %s' % (field.id, value))
+                    if value in [-1, "-1", None, ""]:
+                        def_value = get_unknown_value(item)
+                        if def_value:
+                            log.debug("Setting %s to %s" % (field.id, def_value))
+                            data["%s" % (field.id)] = def_value
+                except:
+                    log.warning('Ups! Tried to get Value from %s which seems to be no field' 
+                                % item.getIdentifier())
             for field in end.fields:
                 if data.has_key("%s" % (field.id)): continue
-                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, ""]:
-                    def_value = get_unknown_value(item)
-                    if def_value:
-                        log.debug("Setting %s to %s" % (field.id, def_value))
-                        data["%s" % (field.id)] = def_value
+                try:
+                    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, ""]:
+                        def_value = get_unknown_value(item)
+                        if def_value:
+                            log.debug("Setting %s to %s" % (field.id, def_value))
+                            data["%s" % (field.id)] = def_value
+                except:
+                    log.warning('Ups! Tried to get Value from %s which seems to be no field' 
+                                % item.getIdentifier())
 
         # Set values
         self.formed_instance.setData(data)



More information about the Mpuls-commits mailing list