[Twisted-web] Add segmentsResolved method to inevow.IResource

Matt Goodall matt at pollenation.net
Thu Sep 9 17:39:19 MDT 2004


On Wed, 2004-09-08 at 16:59 -0400, James Y Knight wrote:
> On Sep 8, 2004, at 7:05 AM, Matt Goodall wrote:
> > I propose that we add one more method to the IResource API - a "hook"
> > method that is called when the final segment has been located, i.e.
> > there are no more path segments to process. The IResource definition of
> > the method would look something like:
> >
> >     def segmentsResolved(self, ctx):
> >         pass
> 
> Why is this different/easier to support/cleaner than returning a 
> resource from renderHTTP?

Because the method would be part of the resource location process and
nothing to do with rendering. It's supposed to return a resource whereas
renderHTTP is supposed to render the page.


> 
> Instead of:
> C1.locateChild, C2.locateChild, C2.renderHTTP, C3.renderHTTP
> we'll have:
> C1.locateChild, C2.locateChild, C2.segmentsResolved, 
> C3.segmentsResolved, C3.renderHTTP.
> 
> I don't see why that's a big difference?

I'm not really talking about t.web/Nevow, I'm talking about application
code where clarity is important. Personally, I don't think returning a
resource from renderHTTP makes sense. Nevow's just located the resource
and asked the resource to render itself, only it doesn't and returns a
new resource instead.




-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.




More information about the Twisted-web mailing list