[Twisted-web] Fragment's IGettable

Christopher Armstrong radeex at gmail.com
Tue Oct 12 23:10:42 MDT 2004

I recently noticed a difference in Nevow from some old SVN checkout vs
0.3. 0.3's behavior got in my way while writing a nevow app, but I'm
not sure if it's considered a bug.

The minimal example is below. The difference is that in the old Nevow,
it would display "Hi"; now it displays big-red-NONE.

After some debugging with the help of Tv and dreid on #twisted-web, we
discovered that it was the change that added an IGettable to
rend.Fragment. It __implements__ IGettable and implements 'get' as
'return self.original', which is None. Removing IGettable from
__implements__ and deleting 'def get' makes it display "hi".

I'll probably work around this problem by not passing the Fragment
through the data machinery, and instead look it up and return it
directly in a render function. I'm just notifying you guys about this
issue and you can decide whether or not it should be considered a bug.
I'm interested in knowing why this IGettable implementation was added
to Fragment, as well.


 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+            http://radix.twistedmatrix.com


from nevow import appserver, rend, loaders, inevow, tags as T

class Page(rend.Page):

    def data_foo(self, ctx, data):
        return rend.Fragment(docFactory=loaders.stan(T.div["Hi"]))

    def render_default(self, ctx, data):
        # data is None here in 0.3 (as is IData(ctx), not so in old-nevow
        return data

    docFactory = loaders.stan(T.html[T.body[

from twisted.application import internet, service

application = service.Application("nevow")
internet.TCPServer(8080, appserver.NevowSite(Page())

More information about the Twisted-web mailing list