Hi,
I wrote a widget for if/then/else functionality in XHTML-templates:
from twisted.web.woven import widgets
class IfThenElseWidget(widgets.Widget):
def setUp(self, request, node, data):
if data: nodeToRemove = self.getPattern("else") else: nodeToRemove = self.getPattern("then")
print "node before=", node.toprettyxml() print "nodeToRemove=", nodeToRemove.toprettyxml()
node.removeChild(nodeToRemove)
print "node after=", node.toprettyxml()
And I get the following log
[-] Log opened. [-] twistd 1.1.1rc1 (C:\Python23\python.exe 2.3.2) starting up [-] reactor class: twisted.internet.default.SelectReactor [-] twisted.web.server.Site starting on 8080 [-] Starting factory <twisted.web.server.Site instance at 0x00A96080> [HTTPChannel,0,127.0.0.1] node before= [HTTPChannel,0,127.0.0.1] <p model="flag" view="if"><font color="red" pattern="else">NEIN!</font><font color="blue" pattern="then">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] </p> [HTTPChannel,0,127.0.0.1] nodeToRemove= <font color="blue">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] node after= [HTTPChannel,0,127.0.0.1] <p model="flag" view="if"><font color="red" pattern="else">NEIN!</font><font color="blue" pattern="then">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] </p> [29/Jan/2004:14:57:51 +0000] "GET /index.rpy/ HTTP/1.1" 200 211 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" [-] (Port 8080 Closed) [-] Stopping factory <twisted.web.server.Site instance at 0x00A96080> [-] Saving web application to web-shutdown.tap... [-] Saved. [-] Main loop terminated. [-] Server Shut Down.
As one can see, "node before" and "node after" are the same, despite the node.romveChilde() statement in setUp()...
Is this a bug ??? Did I miss something ?
Greetings, Uwe
Hi, I found the error: I forgot the flag "clone=False" when calling getPattern, so I tried to remove a child which did not exist...
Greetings, Uwe
Hi,
I wrote a widget for if/then/else functionality in XHTML-templates:
from twisted.web.woven import widgets
class IfThenElseWidget(widgets.Widget):
def setUp(self, request, node, data):
if data: nodeToRemove = self.getPattern("else") else: nodeToRemove = self.getPattern("then") print "node before=", node.toprettyxml() print "nodeToRemove=", nodeToRemove.toprettyxml() node.removeChild(nodeToRemove) print "node after=", node.toprettyxml()
And I get the following log
[-] Log opened. [-] twistd 1.1.1rc1 (C:\Python23\python.exe 2.3.2) starting up [-] reactor class: twisted.internet.default.SelectReactor [-] twisted.web.server.Site starting on 8080 [-] Starting factory <twisted.web.server.Site instance at 0x00A96080> [HTTPChannel,0,127.0.0.1] node before= [HTTPChannel,0,127.0.0.1] <p model="flag" view="if"><font color="red" pattern="else">NEIN!</font><font color="blue" pattern="then">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] </p> [HTTPChannel,0,127.0.0.1] nodeToRemove= <font color="blue">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] node after= [HTTPChannel,0,127.0.0.1] <p model="flag" view="if"><font color="red" pattern="else">NEIN!</font><font color="blue" pattern="then">jAWOLL!</font> [HTTPChannel,0,127.0.0.1] </p> [29/Jan/2004:14:57:51 +0000] "GET /index.rpy/ HTTP/1.1" 200 211 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" [-] (Port 8080 Closed) [-] Stopping factory <twisted.web.server.Site instance at 0x00A96080> [-] Saving web application to web-shutdown.tap... [-] Saved. [-] Main loop terminated. [-] Server Shut Down.
As one can see, "node before" and "node after" are the same, despite the node.romveChilde() statement in setUp()...
Is this a bug ??? Did I miss something ?
Greetings, Uwe
Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web