[Twisted-Python] A new & improved IResource

Laurens Van Houtven _ at lvh.cc
Mon Jun 13 18:30:04 EDT 2011


On Mon, Jun 13, 2011 at 3:38 PM, <exarkun at twistedmatrix.com> wrote:

> Another thing we want is something closer to locateChild as Nevow and
> web2 had.  The key feature is being able to consume multiple path
> segments (or none at all) at a time if desired.
>
> Jean-Paul
>

I added it to the ticket.

Someone on IRC mentioned that locateChild isn't exactly perfect either --
how does it differ from the idealized API?

For the people who hadn't seen locateChild before (much like myself) -- the
main difference is that instead of just taking the *next* segment, it takes
all of the remaining ones, and instead of returning a single child, it
returns a child and the remaining segments. A possible problem with this is
that people might get the impression they should mess with the segments...
Comments welcome.

I'm also not sure if it should be allowed to return an IResource (and
basically use the IResource getChild behavior whenever you see an
IResource...) or if it should only return the new things. Perhaps there
could be an adapter: if entity.locateChild([a, b, c]) returns a (resource,
[b, c]), the resource is adapted to IEntity (working title for
I2NewResource2), and the adapter's .locateChild([b, c]) call gets translated
into self.wrappedResource.getChild(b).getChild(c), or something.


cheers
lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110614/26666d31/attachment.htm 


More information about the Twisted-Python mailing list