[Twisted-Python] wxreactor hack
Eric Radman
theman at eradman.com
Sat Jan 10 15:10:37 EST 2004
Hi All,
It seems that Woven escapes on all text returned by wmfactory_ methods.
Can this behavior be changed? I would like to build a model function
that returns an XML fragment, but Woven applies microdom.escape() to the
strings I return!
Eric Radman
theman at eradman.com
article.py:
----------------------------------------------------
import os
from twisted.web import microdom
from twisted.web.woven import page
from cStringIO import StringIO
class MyPage(page.Page):
· def getXMLDocument(self, request):
· · global xmldoc
· ·
· · try:
· · · return xmldoc
· · except:
· · · code = request.args.get("code", [None])[0]
· · · xmlfile = open(os.path.abspath("articles/%s.xml" % code), "r")
· · · xmltext = xmlfile.read()
· · · xmlfile.close()
· · · xmldoc = microdom.parseString(xmltext)
· · · return xmldoc
· def wmfactory_Topic(self, request):
· · return "Title"
·
· def wmfactory_Content(self, request):
· · xmldoc = self.getXMLDocument(request)
· · content = xmldoc.getElementsByTagName("content")[0]
· · return content.toxml()
· def wmfactory_Summary(self, request):
· · return "Summary"
More information about the Twisted-Python
mailing list