[Mpuls-commits] r308 - in wasko/trunk: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 26 12:23:55 CET 2009


Author: teichmann
Date: 2009-02-26 12:23:53 +0100 (Thu, 26 Feb 2009)
New Revision: 308

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/phases_factory.py
Log:
Fixed bug in phase evaluation.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-26 09:30:34 UTC (rev 307)
+++ wasko/trunk/ChangeLog.txt	2009-02-26 11:23:53 UTC (rev 308)
@@ -1,3 +1,9 @@
+2009-02-26	Sascha L. Teichmann <teichmann at intevation.de>
+
+	* waskaweb/model/phases_factory.py: Fixed one code path the inverts
+	  the results of rule evaluation leading to wrong list of missing fields.
+	  Left debug code in. (commented out)
+
 2009-02-26	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 
 	* waskaweb/public/styles/color3.css: Rows of Radiomatrix are now

Modified: wasko/trunk/waskaweb/model/phases_factory.py
===================================================================
--- wasko/trunk/waskaweb/model/phases_factory.py	2009-02-26 09:30:34 UTC (rev 307)
+++ wasko/trunk/waskaweb/model/phases_factory.py	2009-02-26 11:23:53 UTC (rev 308)
@@ -91,13 +91,28 @@
     def isPhaseComplete(self, phase):
         return not bool(self.missingFields(phase))
 
+#    def missingFields(self, phase):
+#        outfile = None
+#        try:
+#            outfile = open("/tmp/phases.txt", "a")
+#            return self.missingFieldsX(phase, outfile)
+#        finally:
+#            if outfile:
+#                try: outfile.close()
+#                except: pass
+
+    #def missingFieldsX(self, phase, outfile):
     def missingFields(self, phase):
 
+        #print >> outfile, "\nEvaluating phase '%s' -------------------------------" % phase
+
         vars = self.formed.getPhaseVars(phase)
         if not vars: return []
 
         try:
-            return self.missing_cache[phase]
+            missing = self.missing_cache[phase]
+            #print >> outfile, "using phase cache: %s " % ', '.join([x.getName() for x in missing])
+            return missing
         except KeyError:
             pass
 
@@ -107,10 +122,12 @@
         self.missing_cache[phase] = missing
         for var in vars:
             var_name = var.getName()
+            #print >> outfile, "checking var '%s'" % var_name
 
             try:
                 result = self.var_eval_cache[var_name]
-                if result: missing.append(var)
+                if not result: missing.append(var)
+                #print >> outfile, "var cache -> %s" % result
                 continue
             except KeyError:
                 pass
@@ -126,6 +143,7 @@
                 rule_name = rule.getName()
                 try:
                     result = self.rule_eval_cache[rule_name]
+                    #print >> outfile,  "eval cache rule '%s' -> %s" % (rule_name, result)
                 except KeyError:
                     expr   = rule.getExpr()
                     deps   = expr.getDependencies()
@@ -134,6 +152,8 @@
                         result = expr.evaluate(params)
                     except:
                         result = True
+                    #print >> outfile, "evaluate '%s' -> %s" % (rule.getAttribute('expr'), result)
+                    #print >> outfile, "    params: %s" % repr(params)
                     self.rule_eval_cache[rule_name] = result
 
                 if not result: break
@@ -141,6 +161,7 @@
             self.var_eval_cache[var_name] = result
             if not result: missing.append(var)
 
+        #print >> outfile, "missing: %s " % ', '.join([x.getName() for x in missing])
         return missing
 
     def getLinkListForPhase(self, phase, navigation=None, link=None):



More information about the Mpuls-commits mailing list