Warning
This documentation does not refer to the most recent version of Pylons. Current Documentation
The rest module is accessible via the pylons.decorators module.
Restricts access to the function depending on HTTP method
Example:
class SomeController(BaseController):
@pylons.rest.restrict('GET')
def comment(self, id):
Dispatches to alternate controller methods based on HTTP method
Multiple keyword arguments should be passed, with the keyword corresponding to the HTTP method to dispatch on (DELETE, POST, GET, etc.) and the value being the function to call. The value should not be a string, but the actual function object that should be called.
Example:
class SomeController(BaseController):
@pylons.rest.dispatch_on(POST='create_comment')
def comment(self):
# Do something with the comment
def create_comment(self, id):
# Do something if its a post to comment
See the source for more information.