API Documentation

crabpy_pyramid.add_route(config, name, pattern, *args, **kwargs)[source]

Adds a pyramid route to the config. All args and kwargs will be passed on to config.add_route.

This exists so the default behaviour of including crabpy will still be to cache all crabpy routes.

crabpy_pyramid.conditional_http_tween_factory(handler, registry)[source]

Tween that adds ETag headers and tells Pyramid to enable conditional responses where appropriate.

crabpy_pyramid.get_adressenregister(registry)[source]

Get the Adresssenregister Gateway

Return type

crabpy.gateway.adressenregister.Gateway

# argument might be a config or a request

crabpy_pyramid.get_capakey(registry)[source]

Get the Capakey Gateway

Return type

crabpy.gateway.capakey.CapakeyRestGateway

crabpy_pyramid.get_crab(registry)[source]

Get the Crab Gateway

Return type

crabpy.gateway.crab.CrabGateway

# argument might be a config or a request

crabpy_pyramid.includeme(config)[source]

Include crabpy_pyramid in this Pyramid application.

Parameters

config (pyramid.config.Configurator) – A Pyramid configurator.

crabpy_pyramid.main(global_config, **settings)[source]

This function returns a Pyramid WSGI application.

Utils module

Utility functions to help with range handling.

New in version 0.1.0.

crabpy_pyramid.utils.parse_range_header(range)[source]

Parse a range header as used by the dojo Json Rest store.

Parameters

range (str) – The content of the range header to be parsed. eg. items=0-9

Returns

A dict with keys start, finish and number or False if the range is invalid.

crabpy_pyramid.utils.range_return(request, items)[source]

Determine what range of objects to return.

Will check fot both Range and X-Range headers in the request and set both Content-Range and ‘X-Content-Range’ headers.

Return type

list

crabpy_pyramid.utils.set_http_caching(request, gateway='crab', region='permanent')[source]

Set an HTTP Cache Control header on a request.

Parameters
  • request (pyramid.request.Request) – Request to set headers on.

  • gateway (str) – What gateway are we caching for? Defaults to crab.

  • region (str) – What caching region to use? Defaults to permanent.

Return type

pyramid.request.Request