[Formed-commits] r355 - trunk/formed/formed/plugins/modify
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 8 17:55:51 CEST 2010
Author: torsten
Date: 2010-04-08 17:55:48 +0200 (Thu, 08 Apr 2010)
New Revision: 355
Modified:
trunk/formed/formed/plugins/modify/rules.py
Log:
* formed/formed/plugins/modify/rules.py
(GenerateRequiredRules.generateDateSequenceRules): Add error mark to
rules. Generete each rule twice to be able to render errors at both
datefields.
Modified: trunk/formed/formed/plugins/modify/rules.py
===================================================================
--- trunk/formed/formed/plugins/modify/rules.py 2010-04-07 07:08:37 UTC (rev 354)
+++ trunk/formed/formed/plugins/modify/rules.py 2010-04-08 15:55:48 UTC (rev 355)
@@ -15,6 +15,7 @@
import re
import sys
+import copy
ORDER_RE = re.compile("([^;]*);(.*)")
@@ -224,22 +225,32 @@
dates = dict([(d.getName(), d) for d in all_dates])
for idx, pair in enumerate(pairs):
- rule = data.RuleLeaf()
- rule.setName("date-sequence-rule-%d" % idx)
+ rule1 = data.RuleLeaf()
+ rule2 = data.RuleLeaf()
+ rule1.setName("date-sequence-rule-%d" % idx)
+ rule2.setName("date-sequence-rule-%d" % idx)
d1, d2 = dates[pair[0]], dates[pair[1]]
+ rule1.setMark("error:%s" % d1.getName())
+ rule2.setMark("error:%s" % d2.getName())
desc1, desc2 = [u" / ".join(x) for x in remove_common_head(
descriptions(d1), descriptions(d2))]
- rule.setValue(DATE_RULE_VALUE % {
+ rule1.setValue(DATE_RULE_VALUE % {
'a_desc': desc1,
'b_desc': desc2 })
+ rule2.setValue(DATE_RULE_VALUE % {
+ 'a_desc': desc1,
+ 'b_desc': desc2 })
param = { 'a': pair[0], 'b': pair[1] }
- rule.setDescription(DATE_RULE_DESC % param)
+ rule1.setDescription(DATE_RULE_DESC % param)
+ rule2.setDescription(DATE_RULE_DESC % param)
param = dict([(k, var_type.substitute(v)) for k, v in param.iteritems()])
- rule.setExpr(DATE_RULE_EXPR % param)
+ rule1.setExpr(DATE_RULE_EXPR % param)
+ rule2.setExpr(DATE_RULE_EXPR % param)
- d1.getParent().addChild(rule)
+ d1.getParent().addChild(rule1)
+ d2.getParent().addChild(rule2)
for d in today_in_past.copy():
stack = [ d ]
More information about the Formed-commits
mailing list