restish.resource

Base Resource class and associates methods for children and content negotiation

class restish.resource.AnyChildMatcher

Bases: object

A @child matcher that will always match, returning to match args and the list of segments unchanged.

class restish.resource.DELETE(accept='*/*', content_type='*/*')

Bases: restish.resource.MethodDecorator

http DELETE method

class restish.resource.GET(accept='*/*', content_type='*/*')

Bases: restish.resource.MethodDecorator

http GET method

class restish.resource.HEAD(accept='*/*', content_type='*/*')

Bases: restish.resource.MethodDecorator

http HEAD method

class restish.resource.MethodDecorator(accept='*/*', content_type='*/*')

Bases: object

content negotition decorator base class. See DELETE, GET, PUT, POST

class restish.resource.POST(accept='*/*', content_type='*/*')

Bases: restish.resource.MethodDecorator

http POST method

class restish.resource.PUT(accept='*/*', content_type='*/*')

Bases: restish.resource.MethodDecorator

http PUT method

class restish.resource.Resource

Bases: object

Base class for additional resource types.

Provides the basic API required of a resource (resource_child(request, segments) and __call__(request)), possibly dispatching to annotated methods of the class (using metaclass magic).

resource_child(request, segments)
class restish.resource.ResourceMethodWrapper(func)

Bases: object

Wraps a @resource.GET etc -decorated function to ensure the function is only called with a matching request. If the request does not match then an HTTP error response is returned.

Implementation note: The wrapper class is always added to decorated functions. However, the wrapper is discarded for Resource methods at the time the annotated methods are collected by the metaclass. This is because the Resource._call__ is already doing basically the same work, only it has a whole suite of dispatchers to worry about.

class restish.resource.TemplateChildMatcher(pattern)

Bases: object

A @child matcher that parses a template in the form /fixed/{dynamic}/fixed, extracting segments inside {} markers.

restish.resource.child(matcher=None)

Child decorator used for finding child resources

This Page

Quick search