Latest Version: 0.9.6.2

Warning

This documentation does not refer to the most recent version of Pylons. Current Documentation

rest

REST decorators


Functions

f restrict() ...

Restricts access to the function depending on HTTP method

Example:

class SomeController(BaseController):

    @pylons.rest.restrict('GET')
    def comment(self, id):

f dispatch_on() ...

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.

Top