Add request context for GENI rspecs
authorAndy Bavier <acb@cs.princeton.edu>
Tue, 12 Jun 2012 20:31:59 +0000 (16:31 -0400)
committerAndy Bavier <acb@cs.princeton.edu>
Tue, 12 Jun 2012 20:31:59 +0000 (16:31 -0400)
sfatables/runtime.py
sfatables/xmlrule.py

index e22967c..b7c3444 100644 (file)
@@ -56,8 +56,8 @@ class SFATablesRules:
                 
     def add_request_context_to_rspec(self, doc):
         p = doc.xpathNewContext()
-        context = p.xpathEval("//RSpec")
-        if (not context):
+        context = p.xpathEval("//*")
+        if not context or context[0].name not in ['RSpec', 'rspec']:
             raise Exception('Request is not an rspec')
         else:
             # Add the request context
index 46f3601..ff3b3ef 100644 (file)
@@ -61,8 +61,8 @@ class XMLRule:
 
     def add_rule_context_to_rspec(self, doc):
         p = doc.xpathNewContext()
-        context = p.xpathEval("//RSpec")
-        if (not context):
+        context = p.xpathEval("//*")
+        if not context or context[0].name not in ['RSpec', 'rspec']:
             raise Exception('Request is not an rspec')
         else:
             # Add the request context