rum.router

rum.router.resource_action(typ, method='GET')

Tags a controller action as being accesible by given HTTP method to handle a typ of either member or collection.

Example:

>>> class DummyController(object):
...     @resource_action('collection', 'GET')
...     def index(self): pass
...     @resource_action('member', 'GET')
...     def show(self): pass
...     @resource_action('member', 'PUT')
...     def update(self): pass

>>> get_resource_actions(DummyController, 'collection')
{'index': 'GET'}
>>> d = get_resource_actions(DummyController, 'member')
>>> d['update']
'PUT'
>>> d['show']
'GET'

Actions are inheritted:

>>> class SubDummyController(DummyController):
...     @resource_action('member', 'DELETE')
...     def delete(self): pass
...     @resource_action('collection', 'POST')
...     def index(self): pass

>>> get_resource_actions(SubDummyController, 'collection')
{'index': 'POST'}
>>> d = get_resource_actions(SubDummyController, 'member')
>>> d['update']
'PUT'
>>> d['show']
'GET'
>>> d['delete']
'DELETE'

RumRouter

class rum.router.RumRouter(always_scan=True)

Table Of Contents

Previous topic

rum.wsgiapp

Next topic

rum.genericfunctions

This Page