[Twisted-Python] [PATCH] domhelpers.py

Ken Kennedy kkennedy at kenzoid.com
Tue Jul 23 19:43:48 EDT 2002


I've been working on porting the blog example to the new 0.19
DOMTemplate format, as an opportunity to play with some Twisted
code. In doing so, I think I've found this big, bad single-line, 5
character patch for domhelpers.py. Patch is attached. AFAICT, this is
correct; I'll admit, though, I'm a python journeyman at best, so I may
have mis-fixed.

Also, I should be finished with the blog example in a day or two...is
there interest in replacing the old-style one? If so, where should I
send the code? After finishing the straight port, I'm going to look at
implementing some authorization via Twisted Cred; I'm trying to decide
between using Zope and Twisted for some future projects, so I'm
playing with comparable functionalities...I have to admit, Twisted is
pretty dang cool!

Take care...

--

Ken Kennedy	| http://www.kenzoid.com	| kenzoid at io.com

-------------- next part --------------
*** orig_domhelpers.py	Tue Jul 23 19:29:28 2002
--- /usr/lib/python2.1/site-packages/twisted/python/domhelpers.py	Tue Jul 23 01:26:14 2002
***************
*** 10,16 ****
      for child in node.childNodes:
          if child.nodeValue:
              child.replaceData(0, len(child.nodeValue), child.nodeValue % subs)
!         self.substitute(request, child, subs)
  
  def _get(node, nodeId):
      if hasattr(node, 'hasAttributes') and node.hasAttributes() and ((str(node.getAttribute("id")) == nodeId) or (str(node.getAttribute("class")) == nodeId) or (str(node.getAttribute("model")) == nodeId)):
--- 10,16 ----
      for child in node.childNodes:
          if child.nodeValue:
              child.replaceData(0, len(child.nodeValue), child.nodeValue % subs)
!         substitute(request, child, subs)
  
  def _get(node, nodeId):
      if hasattr(node, 'hasAttributes') and node.hasAttributes() and ((str(node.getAttribute("id")) == nodeId) or (str(node.getAttribute("class")) == nodeId) or (str(node.getAttribute("model")) == nodeId)):


More information about the Twisted-Python mailing list