Add request context for GENI rspecs
[sfa.git] / sfatables / runtime.py
index 99226f4..b7c3444 100644 (file)
@@ -2,15 +2,13 @@
 
 import sys
 import os
-import pdb
-from optparse import OptionParser
 
 import libxml2
+import libxslt
 
-from sfatables import commands
-from sfatables.globals import *
-from sfatables.commands.List import *
-from sfatables.xmlrule import *
+from sfatables.globals import sfatables_config
+from sfatables.commands.List import List
+from sfatables.xmlrule import XMLRule
 
 class SFATablesRules:
     def __init__(self, chain_name):
@@ -58,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