[Web-SIG] routing_args (was url_vars)

Luke Arno luke.arno at gmail.com
Mon Nov 13 21:57:30 CET 2006


On 11/13/06, Joe Gregorio <joe at bitworking.org> wrote:
> On 11/13/06, Ian Bicking <ianb at colorstudy.com> wrote:
> > Why is this a problem?
> >
> > I put in the note about SCRIPT_NAME/PATH_INFO, because generally
> > SCRIPT_NAME represents the consumed path.  Dispatchers typically consume
> > the path when they do their dispatching.
> >
> > If you leave SCRIPT_NAME, you are presuming that the application has
> > knowledge of how the dispatcher works.  The whole point of the spec is
> > that consumers don't need to know how the variables got there.
>
> So this lets me, for example, dispatch Selectors to other
> Selectors without them knowing about each other? That works for me.

I didn't pipe up about this because, in general,
you should consume unless you have a good
reason not to. I will add explicit mention of all
this to the Selector web page.

I left this out of Selector because, given the
typical usage, one would almost always end up
consuming the whole remainder of the path
and then I would just end up creating an
environ key like 'selector.original_path' or some
such. It does not seem readily generalizable to
me in that form so I decided that if I were to
chain selectors, I would just wrap them in
small path-consuming middlewares as needed.

Now that I think about this again, I will add a
utility to Selector for creating path-consuming
MWs. That way you can do the following to
have '/foo' consumed before s2 gets called:

s1 = Selector(prefix='/foo')
s2 = Selector(prefix='/bar')
con = consuming(s2, '/foo')
s1.add('/bar', _ANY_=con)

This is a lame patten unless you have a good
reason for it, of course. I have not had
occasion to do this in real life, as of yet.

Cheers,
- Luke


More information about the Web-SIG mailing list