wJIc@ssdZddkZddklZddklZddklZddgZeie Z dZ d Z dS( sREST decoratorsiN(t decorator(tabort(t get_pylonst dispatch_ontrestrictcsfd}t|S(sRestricts access to the function depending on HTTP method Example: .. code-block:: python from pylons.decorators import rest class SomeController(BaseController): @rest.restrict('GET') def comment(self, id): csYt|iijo3tidtddddifgn|||S(sWrapper for restrictsMethod not allowed by restrictitheaderstAllowt,(RtrequesttmethodtlogtdebugRtjoin(tfunctargstkwargs(tmethods(s:/usr/lib/python2.6/site-packages/pylons/decorators/rest.pyt check_methodss &(R(RR((Rs:/usr/lib/python2.6/site-packages/pylons/decorators/rest.pyR sc sfd}t|S(sDispatches 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: .. code-block:: python 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 csbit|ii}|o0t||}tid||i||S||||S(sWrapper for dispatch_onsDispatching to %s instead(tgetRRR tgetattrR R t _inspect_call(R tselfRRt alt_method(t method_map(s:/usr/lib/python2.6/site-packages/pylons/decorators/rest.pyt dispatcher<s (R(RR((Rs:/usr/lib/python2.6/site-packages/pylons/decorators/rest.pyR$s( t__doc__tloggingRtpylons.controllers.utilRtpylons.decorators.utilRt__all__t getLoggert__name__R RR(((s:/usr/lib/python2.6/site-packages/pylons/decorators/rest.pyts