On 2009-06-19, P.J. Eby <p...@telecommunity.com> wrote: > So you could implement your urlmap above more or less like this: > > @bobo.scan_class > class UrlMap(dict): > > @bobo.subroute('/:name') > def subitem(self, name): > try: > return self[name] > except KeyError: > ... > > Although you'd probably need a __setitem__ that split on '/' and created > sub-UrlMap instances if they don't already exist, but you get the idea I > hope.
Also, I actually have my version of URLMap (with dispatching on host and protocol removed and with indexing instead of prefix scan): http://code.google.com/p/pasteob/source/browse/trunk/pasteob/__init__.py#170 PathMap.__getitem__ method can be ignored as it's used for inspection only, not when actually dispatching. _______________________________________________ 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