d = cherrypy.dispatch.RoutesDispatcher()
d.connect('create_something', '/something', controller=root.something_controller, action='create_something',conditions=dict(method=['POST']))
What this is saying is I want a to route all routes that match /something and are of the method "POST" to the controller root.something_controller and the method "create_something". Thats it. PUT is just as easy.
d.connect('create_something', '/something/:id', controller=root.something_controller, action='update_something',conditions=dict(method=['PUT']))
Same thing as above except the method update_something will get the param id.
No comments:
Post a Comment