[Web-SIG] Announcing bobo
Sergey Schetinin
maluke at gmail.com
Fri Jun 19 02:36:45 CEST 2009
On 2009-06-19, P.J. Eby <pje at 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.
More information about the Web-SIG
mailing list