[Twisted-web] Cannot render a LivePage more than once

Juanjo Conti jjconti at gmail.com
Thu Jul 9 13:03:44 EDT 2009


HI! I'm using LivePage from Nevow.Athena like this:

class TerPage(LivePage):
    docFactory = loaders.stan(T.html[
        T.head(render=T.directive('liveglue')),
        T.body(render=T.directive('myElement'))])

    def beforeRender(self, ctx):
        d = self.notifyOnDisconnect()
        d.addErrback(self.disconn)

    def disconn(self, reason):
        del lectores[hash(self.element)]

    def render_myElement(self, ctx, data):
        self.element = TempElement()
        self.element.setFragmentParent(self)
        return ctx.tag[self.element]

    def child_(self, ctx):
        return TerPage()


site = appserver.NevowSite(TerPage())
reactor.listenTCP(8009, site)

When I load the page for first time, it's rendered ok. But if I hit
the reload button or someone access it from other computer, this
exception is shown:

Cannot render a LivePage more than once.

Could you point me the correct way of doing it?

Thanks,

-- 
Juanjo Conti



More information about the Twisted-web mailing list