Fixed a bug we ran into a demo with Andy. Stop on terminal rules ONLY if it has matched.
authorSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 27 Oct 2009 02:19:29 +0000 (02:19 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 27 Oct 2009 02:19:29 +0000 (02:19 +0000)
sfatables/runtime.py
sfatables/test.sfarspec
sfatables/xmlrule.py

index b76ec0a..ef3ccc4 100644 (file)
@@ -74,8 +74,8 @@ class SFATablesRules:
             intermediate_rspec = doc
 
             for rule in self.sorted_rule_list:
-                intermediate_rspec  = rule.apply_interpreted(intermediate_rspec)
-                if (rule.terminal):
+                (matched,intermediate_rspec) = rule.apply_interpreted(intermediate_rspec)
+                if (rule.terminal and matched):
                     break
 
             final_rspec = self.wrap_up(intermediate_rspec) 
index f0a856a..a7173e8 100644 (file)
@@ -1,6 +1,6 @@
 <!-- run "runtime.py sfarspec" to apply current rule set to this file -->
 
-<rspec>
+<RSpec>
      <request>
         <nodespec>
             <node name="plc.princeton.planetlab-01"/>
@@ -10,4 +10,4 @@
             <node name="plc.tp.planetlab3"/>
         </nodespec>
     </request>
-</rspec>
+</RSpec>
index d8b30dc..bd41dbf 100644 (file)
@@ -85,9 +85,9 @@ class XMLRule:
         #       else rspec
         
         if (self.match(rspec)):
-            return self.wrap_up(self.target(rspec))
+            return (True,self.wrap_up(self.target(rspec))
         else:
-            return self.wrap_up(rspec)
+            return (False,self.wrap_up(rspec))
 
 
     def apply_compiled(rspec):