pylons.decorators.rest – REST-ful Decorators

REST decorators

Module Contents

pylons.decorators.rest.dispatch_on(**method_map)

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 be a string indicating the name of the function to dispatch to.

Example:

from pylons.decorators import rest

class SomeController(BaseController):

    @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
pylons.decorators.rest.restrict(*methods)

Restricts access to the function depending on HTTP method

Example:

from pylons.decorators import rest

class SomeController(BaseController):

    @rest.restrict('GET')
    def comment(self, id):
Read the Docs v: v1.0.1rc1
Versions
latest
v1.0.1rc1
v0.9.7
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.