[Twisted-Python] Woven page instances deferring to each other...

Stuart Hungerford stuart.hungerford at anu.edu.au
Wed Oct 8 01:33:41 EDT 2003


Hi all,

I have a Twisted web application that uses Woven to generate
various HTML pages.  The application knows about a bunch of
"error" states which have one Woven page instance per state:


class error_state_1(twisted.web.woven.page.Page):
     isLeaf = 1
     templateFile = ...

     # usual wmfactory_ and wvupdate_ methods


class error_state_2(twisted.web.woven.page.Page):
     isLeaf = 1
     templateFile = ...

     # usual wmfactory_ and wvupdate_ methods


class error_state_3(twisted.web.woven.page.Page):
     isLeaf = 1
     templateFile = ...

     # usual wmfactory_ and wvupdate_ methods


In another Woven page the application can detect these
"error" states and I would like to optionally "defer" the HTML
generation to the existing error pages:


class application_page(twisted.web.woven.page.Page):
     isLeaf = 1
     templateFile = ...

     # methods

     def wvupdate_content(self, request, node, data):
         if error_state_1:
             # defer to error_state_1 page
         elif error_state_2:
             # defer to error_state_2 page
         ...
         else:
             # situation normal, generate content XHTML


In practice there are a number of application pages and they
may all need to detect and report the "error" conditions.

So, my question is what's the best way to do this kind of thing
in Woven?  I seem to recall something about expanding a Woven
"macro" page being discussed on the list, but I'm still grepping
for that.

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