[Twisted-Python] Rendering Woven pages from non-Woven resources?

Stuart Hungerford stuart.hungerford at anu.edu.au
Sun Oct 19 22:35:32 MDT 2003


Hi all,

I have a twisted web application that was created without the
benefit of Woven, where HTML is generated in subclasses of
Resource in the class' render() method.  This is my "old"
application.

I also have a "new" application where most HTML is generated
via subclasses of the Woven page class using various factory
methods etc.

I'd like to standardize both applications to use the Page
subclasses from the "new" application and the HTML they
generate.

So ideally I'd have:


        class new_page(twisted.web.woven.page.Page):
            isLeaf = 1
            templateFile = 'new.xhtml'

            def wmfactory_something(self, request)
                # etc


        # ...

        class old_resource(twisted.web.resource.Resource):
            isLeaf = 1
            def render(self, request):
                # get new_page() rendered from here


To make that last commented bit work, do I need to override
a new render() method for new_page that duplicates the
factory methods etc?  Or can I get the same effect another way?

Any advice much appreciated,


Cheers,

Stu

--
:: Stuart Hungerford (stuart.hungerford at anu.edu.au)
:: ANU Internet Futures Group





More information about the Twisted-Python mailing list