Just wasted better part of a day coming up with (and then blogging about) a 
more refined approach for automatically routing RESTful controllers and 
thought I'd share.  Note that I'm no Python expert and I'm a total web.py 
n00b so can't vouch for whether this is well done nor if it's particularly 
original, but hopefully someone here can benefit from it. 
 Comments/corrections/enhancements/prior art references welcome on the blog 
(not sure if I'll be able to actively participate in discussion here).

http://www.codesuck.com/2012/07/automatic-routing-for-restful-webpy.html

The TL;DR is with the autoroute() function given in the post you can write 
a simple restful controller 

class FooBarController():

  *__metaclass__ = autoroute()*

  def GET(self, foo_id, bar_name):

     # ....


and it will automagically be assigned a URL like

/foo/bar/([0-9]+)/([A-Z])+/?


--Ken

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/webpy/-/qOL-gtrVzZUJ.
To post to this group, send email to webpy@googlegroups.com.
To unsubscribe from this group, send email to 
webpy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to