adhocracy_core.rest.batchview module

POST batch requests processing.

class BatchItemResponse(code: int, title: str, body: dict={})[source]

Bases: object

Wrap the response to a nested request in a batch request.

Attributes:

Code:the status code (int)
Title:the status title (str)
Body:the response body as a JSOn object (dict)

Initialize self.

was_successful()[source]

Return true if batch was successful.

to_dict()[source]

Convert to dict.

class BatchView(context: <InterfaceClass adhocracy_core.resources.root.IRootPool>, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Bases: object

Process batch requests.

post() → dict[source]

Create new resource and get response data.

options() → dict[source]

Return options for batch view.

This currently only exist in order to satisfy the preflight request, which browsers do in CORS situations before doing the actual POST.

copy_header_if_exists(header: str, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Copy header if exists.

copy_attr_if_exists(attributename: str, request: <InterfaceClass pyramid.interfaces.IRequest>)[source]

Copy attr if exists.

includeme(config)[source]

Register batch view.