weaver.tweens

Module Contents

weaver.tweens.LOGGER[source]
weaver.tweens.OWS_TWEEN_HANDLED = 'OWS_TWEEN_HANDLED'[source]
weaver.tweens.http_validate_response_format_tween_factory(handler: weaver.typedefs.ViewHandler, registry: pyramid.registry.Registry) weaver.typedefs.ViewHandler[source]

Tween factory that validates that the specified request Accept header or format queries (if any) is supported.

Note

This tween limits itself to the validation of HTML support according to weaver.wps_restapi_html configuration. Other endpoint-specific format or Content-Type support are handled and validated as per their corresponding endpoint cornice service definitions, which are also represented in the generated OpenAPI specification.

Raises:

HTTPNotAcceptable – if desired Accept or format specifier of content-type is not supported.

weaver.tweens.http_apply_response_format_tween_factory(handler: weaver.typedefs.ViewHandler, registry: pyramid.registry.Registry) Callable[[weaver.typedefs.PyramidRequest], weaver.typedefs.AnyViewResponse][source]

Tween factory that applies the request Accept header according to the requested format for the response.

The requested format in this case takes into account Web-Browsers automatically applying Accept with a combination of visual rendering headers, notably with text/html. In such case, the format is considered to auto-resolve with the default response format of the specific endpoint.

weaver.tweens.error_repr(http_err: pyramid.httpexceptions.HTTPException | weaver.owsexceptions.OWSException | Exception) str[source]

Returns a cleaned up representation string of the HTTP error.

Similar and even extended details relative to the HTTP error message are added to facilitate later debugging.

weaver.tweens.ows_response_tween(request: weaver.typedefs.PyramidRequest, handler: weaver.typedefs.ViewHandler) weaver.typedefs.AnyViewResponse[source]

Tween that wraps any API request with appropriate dispatch of error conversion to handle formatting.

weaver.tweens.ows_response_tween_factory_excview(handler: weaver.typedefs.ViewHandler, registry: pyramid.registry.Registry) weaver.typedefs.ViewHandler[source]

Tween factory which produces a tween which transforms common exceptions into OWS specific exceptions.

weaver.tweens.ows_response_tween_factory_ingress(handler: weaver.typedefs.ViewHandler, registry: pyramid.registry.Registry) weaver.typedefs.ViewHandler[source]

Tween factory which produces a tween which transforms common exceptions into OWS specific exceptions.

weaver.tweens.OWS_RESPONSE_EXCVIEW[source]
weaver.tweens.OWS_RESPONSE_INGRESS[source]
weaver.tweens.HTTP_FORMAT_VALIDATE[source]
weaver.tweens.HTTP_FORMAT_RESPONSE[source]
weaver.tweens.includeme(config: pyramid.config.Configurator) None[source]