sjthorne at ozemail.com.au
Sat Aug 10 08:54:26 EDT 2002
-----BEGIN PGP SIGNED MESSAGE-----
Okay, I've been doing some hacking trying to make a small application using
twisted.web and the .rpy stuff, using DOMTemplate.
Ordinarily I'd chat about something like this on the irc channel, but it was
dead quiet. Apart from me talking to myself of course.
in the template:
in the response object
def factory_getBody(self, request, node):
This (when twistd --nodaemon is used) prints 1 twice (instead of the once
This is because of the following section of code:
def getNodeView(self, request, node):
maybeWidget = viewMethod(request, node)
if isinstance(maybeWidget, domwidgets.Widget):
view = maybeWidget
viewMethod = view.generateDOM
This is *bad*. viewMethod in this instance is response.factory_getBody, and in
order to figure out if factory_getBody returns a widget as opposed to an
instance of xml.dom.minidom.Element it actually calls the function to have a
look. If it doesn't return a widget it *throws the result away*. viewMethod
is then returned and used elsewhere, where its actually intended to be used.
Considering that rendering a template node could have program logic in it that
only should be evaluated once per pageview. It could also carry some
expensive database transactions.
Anyhow. I can't figure out how to refactor without breaking Widget
functionality, and the way 'controller' works.
Anyhow. I think I'd call the above a bug report. Maybe with elements of rant
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
-----END PGP SIGNATURE-----
More information about the Twisted-Python