On 11/13/06, Joe Gregorio <[EMAIL PROTECTED]> wrote: > On 11/13/06, Ian Bicking <[EMAIL PROTECTED]> 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 _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com