[Twisted-web] Including templates in CGI

Little mordaha at gmail.com
Wed Jun 15 11:56:16 MDT 2005

i do it in another way:
 i have a BasePage class - which is a skeleton for other Pages:
 class BasePage(rend.Page):
__implements__ = rend.Page.__implements__
TITLE = "Common Page"
docFactory = loaders.xmlfile("_tpl/common/page.xml")
def render_title(self, ctx, data):
ctx.fillSlots("title", self.TITLE)
return ctx.tag

def render_content(self, ctx, data):
raise NotImplementedError, "You MUST overload render_content() method!!!"
 And BasePage tremplate:
 <n:invisible n:render="content" />
  And then all of the site pages are using this prototype:
class Root(common.BasePage):
def render_content(self, ctx, data):
return loaders.xmlfile("_tpl/root.xml") 

i can return ANY xml-temlate i'd like :)

for example a form or a "form submitted successful" message
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20050615/b0e15620/attachment.htm

More information about the Twisted-web mailing list