[Twisted-web] nested nevow:data?

Jeff Bowden jlb at houseofdistraction.com
Fri Aug 6 17:27:14 MDT 2004


I made a little app to try to try to get nested data declarations 
working (attached).  The app works if I remove nevow:data="outer" from 
the template (render_outer doesn't depend on any data) but otherwise it 
complains:

    nevow.accessors.NoAccessor: None does not implement IContainer, and
    there is no registered adapter.

My expectation was that since data_outer just returns self this should 
just mean that there are two copies of the TestPage instance on the 
context stack.  Apparently my understanding is wrong.  Are there any 
working examples of nested data declarations out there?


-------------- next part --------------
from twisted.application import service, internet
from nevow import rend, loaders, appserver


class TestPage(rend.Page):
    docFactory = loaders.htmlfile("testpage.html")
    def __init__(self):
        rend.Page.__init__(self)


    def data_outer(self, context, data):
        return self

    def data_inner(self, context, data):
        return [{'prop.1': 'data1', 'prop.2': 'data2'}]

    def render_outer(self, context, data):
        context.fillSlots("outer.title", "I'm soooo outer")
        return context.tag

site = appserver.NevowSite(TestPage())
 
application = service.Application("example")
internet.TCPServer(8086, site).setServiceParent(application)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040806/7c46a532/testpage.html


More information about the Twisted-web mailing list