views:

65

answers:

1

After using werkzeug as a web framework (which is great and simple, but doesnt support some features), i'm now trying cherrypy.

Now what I miss in cherrypy is werkzeug's elegant way of building urls (e.g. for links in templates) using the name of a decorated function like this:

@expose('/archive/<int:year>/<int:month>')
def archive(request, year, month):
    pass

>>> url_for('archive',2010,04)
'/archive/2010/04'

I didn't find a similar way in cherrypy, did I miss it?

+2  A: 

You didn't miss it. CherryPy doesn't have that sort of approach built into the 'expose' decorator. You can, however, use the builtin Routes dispatcher with your application, which has a similar URL template syntax. If you'd like to try to wrap that up into a decorator like werkzeug's, we'd love to see the code pasted on the http://tools.cherrypy.org wiki. Bonus points for sticking that logic onto the RoutesDispatcher class itself.

fumanchu