[Twisted-web] problem with missing data in nevow

Eric Faurot eric.faurot at gmail.com
Thu Sep 1 06:15:57 MDT 2005


The following example result in an endless (actually until python runs out
of mem) loop. The problem is that the data passed to render_heading is
actually a stan tree displaying an error message (from rend.DataFactory.child).
If the data is not found, the render should not be called at all.

8<-----------
from nevow import rend, static, tags as t, loaders
from nevow.appserver import NevowSite
from twisted.application import service, internet

class Page(rend.Page):

     docFactory = loaders.stan(
        t.html[
          t.head[
            t.title[ 'title' ]
          ],
          t.body[
            t.h1(render=t.directive('heading'), data=t.directive('hdata'))
          ]
        ])

     def render_heading(self, ctx, data):
         return ctx.tag[data]
     
     #def data_hdata(self, ctx, data):
     #    return 'Hey'
     
application = service.Application('Test')
internet.TCPServer(8080,
                   NevowSite(Page())
).setServiceParent(application)


More information about the Twisted-web mailing list