Skip to content

Commit

Permalink
Handle namespaces (by ignoring them)
Browse files Browse the repository at this point in the history
  • Loading branch information
regebro committed Nov 15, 2017
1 parent 2a7f86c commit 2937066
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/z3c/rml/directive.py
Expand Up @@ -99,10 +99,25 @@ def getAttributeValues(self, ignore=None, select=None, attrMapping=None,

def processSubDirectives(self, select=None, ignore=None):
# Go through all children of the directive and try to process them.
for element in self.element.getchildren():
self._processDirectives(self.element.getchildren(), select, ignore)

def _processDirectives(self, elements, select=None, ignore=None):
# Process elements, with possible recursion from namespaces.
for element in elements:
# Ignore all comments
if isinstance(element, etree._Comment):
continue

# Check for namespaces
if element.tag[0] == '{':
import wingdbstub

# This is a namespace. In the future we may want some sort
# of plugins here. Right now, we just want the contents parsed,
# so we pretend the namespaces children is direct children
# of this directive.
self._processDirectives(element.getchildren(), select, ignore)
continue
# Raise an error/log any unknown directive.
if element.tag not in self.factories:
msg = "Directive %r could not be processed and was " \
Expand Down

0 comments on commit 2937066

Please sign in to comment.