[Twisted-web] Athena LivePage as a main page

Paul Thomas spongelavapaul at googlemail.com
Thu Feb 5 03:43:38 EST 2009


On 5 Feb 2009, at 06:44, Piotr Jackowski wrote:

>
> I'm new to Nevow and Athena.
> I have rather basic question. How to make athena livepage with  
> livefragment available from top path '/'.

I use a static root page that is a rend.Page (i.e. not Athena), then  
use a redirect to the base livepage:

class Root(rend.Page):
     addSlash = True
     def childFactory(self, ctx, name):
         if name == 'main':
             return MainLivePage()
     def renderHTTP(self, ctx):
         request = inevow.IRequest(ctx)
         request.redirect(request.URLPath().child('main'))
         return ''

This Root page will be long lived and a new MainLivePage is created  
for every request. That way the MainLivePage has a connection to the  
browser in the way the Root page couldn't.

If there's a better way to do it, I'd be interested to hear it,
pt.



More information about the Twisted-web mailing list