Phillip J. Eby wrote: > At 04:04 PM 4/28/2006 -0500, Ian Bicking wrote: > >> I don't see why not to use prefix matching. It is more consistent with >> the handling of the default application ('', instead of a method that >> needs to be overridden), and more general, and the algorithm is only >> barely more complex and not what I'd call sophisticated. The default >> application handling in particular means that AppMap isn't really useful >> without subclassing or assigning to .default. >> >> Prefix matching wouldn't show off anything else in wsgiref, > > > Right, that would be taking away one of the main reasons to include it.
That's putting the cart in front of the horse, using a matching algorithm because that's what shift_path_info does, not because it's the most natural or useful way to do the match. I suggest prefix matching not because it shows how the current functions in wsgiref work, but because it shows a pattern of dispatching WSGI applications on a level that is typically (but for WSGI, unnecessarily) built into the server. The educational value is in the pattern, not in the implementation. If you want to show how the functions in wsgiref work, then that belongs in documentation. Which would be good too, people like examples, and the more examples in the wsgiref docs the better. People are much less likely to see examples in the code itself. > To make the real dispatcher, I'd flesh out what I wrote a little bit, to > handle the "default" method in a more meaningful way, including the > redirect. All that should only add a few lines, however. It will still be only a couple lines less than prefix matching. Another issue with your implementation is the use of keyword arguments for the path mappings, even though path mappings have no association with keyword arguments or valid Python identifiers. -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org _______________________________________________ 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