[Formed-commits] r396 - in trunk: . formed/formed/plugins/modify

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 1 15:15:24 CEST 2010


Author: roland
Date: 2010-09-01 15:15:22 +0200 (Wed, 01 Sep 2010)
New Revision: 396

Modified:
   trunk/ChangeLog
   trunk/formed/formed/plugins/modify/rules.py
Log:
issue1050: mandatory fields appearing double

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-08-12 10:03:17 UTC (rev 395)
+++ trunk/ChangeLog	2010-09-01 13:15:22 UTC (rev 396)
@@ -1,3 +1,15 @@
+2010-09-01 Roland Geider <roland.geider at intevation.de>
+
+	* formed/formed/plugins/modify/rules.py: issue1050: mandatory fields
+	  appearing double.
+	  The problem was that the way the formEditor handled fields with
+	  manually created rules changed. Instead of ignoring fields (very
+	  early behaviour) or always generating them (early behaviour), now the
+	  formED will only ignore fields with rules which name starts with
+	  'required-rule-manual'. This is helpful when the rules for mandatory
+	  fields are more complex (e.g. mother's name is only required if
+	  mother is known).
+
 2010-08-10  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* contrib/diff_formed.py: New helperscript to diff to given

Modified: trunk/formed/formed/plugins/modify/rules.py
===================================================================
--- trunk/formed/formed/plugins/modify/rules.py	2010-08-12 10:03:17 UTC (rev 395)
+++ trunk/formed/formed/plugins/modify/rules.py	2010-09-01 13:15:22 UTC (rev 396)
@@ -358,13 +358,19 @@
         widgets = collector.widgets
         # Get all rules in document
 
+        # Make a list of list with manually created required rules that have
+        # some special logic in them
         known_fields = set()
         for r in document.findAllByClass(data.RuleLeaf, mode, allModes):
-            known_fields = known_fields.union(r.getExpr().getDependencies())
+            if 'required-rule-manual' in r.getName():
+                known_fields = known_fields.union(r.getExpr().getDependencies())
+
         rule_counter = len(known_fields)
 
         for w in widgets:
-            #if w.getName() in known_fields: continue
+            # ignore if the rule is in the manual list
+            if w.getName() in known_fields: continue
+            
             flags = w.getFlags()
             if flags.find('required') >= 0:
                 x = var_type.substitute(w.getName())



More information about the Formed-commits mailing list