Adapting Nevow's IRequest for Zope Page Templates (TAL) (For those migrating this way...)


Today's little micro-recipe is how to adapt Nevow's IRequest interface to one which is compatible enough with Zope's TAL request objects that you can port templates from Zope into Twisted fairly quickly. Note, this doesn't include the TemplateAdapter class, nor the Cinemon Template class, which make a Template act like a Nevow resource and add huge amounts of functionality to TAL (respectively). All this does is make it easier to pass in an IRequest to your page template and have the TAL code continue to work as before.

Caveats: I only exposed that functionality I needed, for instance, sessions are not exposed, and the AUTHENTICATED_USER is actually just a Cinemon UserAgent set on the root by the Realm. You should also know that this code was written in a rush, I don't normally make such a mess :) .

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.