Commit 1396b5b6 authored by Guido van Rossum's avatar Guido van Rossum

- Use node.hasAttributes() rather than asking for node.attributes and

  then checking whether it is true.  (Should be slightly faster.)

- Use getAttributeNodeNS() to check for z:omit="" properly.
parent 4b1f6df5
...@@ -115,7 +115,7 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -115,7 +115,7 @@ class TALVisitor(CopyingDOMVisitor):
self.slotIndex = None self.slotIndex = None
def visitElement(self, node): def visitElement(self, node):
if not node.attributes: if not node.hasAttributes():
CopyingDOMVisitor.visitElement(self, node) CopyingDOMVisitor.visitElement(self, node)
return return
macroName = node.getAttributeNS(ZOPE_METAL_NS, "use-macro") macroName = node.getAttributeNS(ZOPE_METAL_NS, "use-macro")
...@@ -131,12 +131,10 @@ class TALVisitor(CopyingDOMVisitor): ...@@ -131,12 +131,10 @@ class TALVisitor(CopyingDOMVisitor):
if slotNode: if slotNode:
self.visitElement(slotNode) self.visitElement(slotNode)
return return
if node.getAttributeNS(ZOPE_TAL_NS, "omit"): if node.getAttributeNodeNS(ZOPE_TAL_NS, "omit"):
# XXX Problem: this DOM implementation doesn't
# differentiate between argument empty and argument
# absent.
# XXX Question: should 'omit' be done before or after # XXX Question: should 'omit' be done before or after
# 'define'? # 'define'? (I.e., is it a shortcut for
# z:condition:"false" or is it stronger?)
return return
defines = node.getAttributeNS(ZOPE_TAL_NS, "define") defines = node.getAttributeNS(ZOPE_TAL_NS, "define")
if defines: if defines:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment