IRenderer interface for Nevow
Hi, While testing out an idea, I noticed that I was implementing IRendererFactory just to turn a class instance into a renderer. For instance: class ISummaryView(compy.Interface): pass 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@pollenation.net Any views expressed are my own and do not necessarily reflect the views of my employer.
participants (1)
-
Matt Goodall