[Twisted-web] IRenderer interface for Nevow

Matt Goodall matt at pollenation.net
Sun Apr 4 18:40:11 MDT 2004


While testing out an idea, I noticed that I was implementing
IRendererFactory just to turn a class instance into a renderer. For

        class ISummaryView(compy.Interface):
        class FooSummaryView(compy.Adapter):
            __implements__ = ISummaryView, IRendererFactory
            def __call__(self, context, data):
                return whatever
That didn't make sense to me and I also had no reason to add
IRendererFactory's renderer() method.

I then noticed that quite a few classes (freeform in particular) that
implement IRendererFactory were actually just renderers and didn't have
or need a renderer() method either.

So ... I created a IRenderer marker interface and changed most uses of
IRendererFactory to IRenderer. See the attached diff (against svn
trunk). It seems to work (i.e. no more tests fail than usual ;-)) but I
didn't want to commit it without some feedback first.

You'll notice that a couple of test_flatstan tests changed slightly to
make them pass. I don't think the renderer function signature was
correct in the context but please shout if you can think of a legitimate
reason why it should be supported.

James Knight (aka foom) suggested that IRenderer may not be needed at
all and that adapting anything callable would probably be enough. That
is probably correct but a) it's too early in the morning to think about
it and b) I'd rather make the change it two steps.

OK, let me know what you think to all this.

Cheers, Matt

Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net

Any views expressed are my own and do not necessarily reflect
the views of my employer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: irendererfactory_irenderer.diff
Type: text/x-patch
Size: 7752 bytes
Desc: not available
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040405/bf977d40/irendererfactory_irenderer.bin

More information about the Twisted-web mailing list