[Web-SIG] Announcing bobo

Sergey Schetinin maluke at gmail.com
Fri Jun 19 02:29:50 CEST 2009


On 2009-06-19, P.J. Eby <pje at telecommunity.com> wrote:
> At 02:46 AM 6/19/2009 +0300, Sergey Schetinin wrote:
>
> > but wouldn't it be nice if we could finally just do
> > things like
> >
> > from somebody_else.forum import ForumApp
> > urlmap['/forum'] = ForumApp(db_config=...)
> >
>
>  The Folder example in the bobo docs does basically that, actually.
>
>  I think perhaps you've misunderstood what Bobo does; it not only provides a
> framework for fixed mappings, it also provides the basis for doing flexible
> mappings.  In fact, that's what subroute parameters are for.
>
>  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:
>             ...

Oh wait, I meant urlmap to be

from paste.urlmap import URLMap
urlmap = URLMap()
...

Should have written that in the first place, sorry.


>  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.
>
>  Bobo's basic design, IOW, allows you to make pretty much any other design
> you like, but is very simple for relatively straightforward subtrees.
>
>  Also, AFAICT, *all* bobo paths are relative paths treating the enclosing
> module or instance as a mount point, and there is nothing stopping you from
> mounting such objects at whatever locations you like.

I think they are, but that's not separate enough from implementation
for me :) The problem is that if one were to actually separate this
mapping completely there's suddenly nothing to the library anymore :)
(I'm exaggerating, but it's not that far from truth).

>  What bobo lacks (that would be nice) is a way to figure out what URL to
> address a specified object by, since the very flexibility that allows
> objects to have more than one name, also means that there is no obvious way
> to find what name to use for an object.
>
>


-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter


More information about the Web-SIG mailing list