From e8d18d70468b223f3e0f46fa7941e062f0477aa8 Mon Sep 17 00:00:00 2001 From: Andy Bavier Date: Tue, 12 Jun 2012 16:31:59 -0400 Subject: [PATCH] Add request context for GENI rspecs --- sfatables/runtime.py | 4 ++-- sfatables/xmlrule.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sfatables/runtime.py b/sfatables/runtime.py index e22967c7..b7c3444d 100644 --- a/sfatables/runtime.py +++ b/sfatables/runtime.py @@ -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 diff --git a/sfatables/xmlrule.py b/sfatables/xmlrule.py index 46f36018..ff3b3ef0 100644 --- a/sfatables/xmlrule.py +++ b/sfatables/xmlrule.py @@ -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 -- 2.43.0