pyramid_jsonapi.workflow package

Module contents

class pyramid_jsonapi.workflow.Doc[source]

Bases: dict

update_child(key, value)[source]
class pyramid_jsonapi.workflow.Rejected(view, rejected=None)[source]

Bases: object

identifier_to_str(identifier)[source]
reject_attributes(identifier, things, reason, *, category='attributes')
reject_object(identifier, reason)[source]
reject_relationships(identifier, things, reason, *, category='relationships')
property rejected_dict
class pyramid_jsonapi.workflow.ResultObject(view, object, related=None)[source]

Bases: object

identifier()[source]
property included_dict
serialise()[source]
property str_identifier
to_dict()[source]
property tuple_identifier
class pyramid_jsonapi.workflow.Results(view, objects=None, many=True, count=None, limit=None, is_included=False, is_top=False, not_found_message='Object not found.')[source]

Bases: object

compute_meta()[source]
data()[source]
filter(predicate, reason='Permission denied', force_rerun=False)[source]
identifiers()[source]
included()[source]
property included_dict
property meta
rel_dict(rel, rel_name, parent_url)[source]
serialise(identifiers=False)[source]
serialise_object_with(method_name)[source]
class pyramid_jsonapi.workflow.SharedState(view, request=None, results=None, document=None, rejected=None)[source]

Bases: object

pyramid_jsonapi.workflow.allowed_rel_changes(rel, view, stage, obj_data, perm)[source]

Authorise write action on a relationship.

pyramid_jsonapi.workflow.execute_stage(view, stages, stage_name, arg)[source]
pyramid_jsonapi.workflow.follow_rel(view, rel_name, include_path=None)[source]

True if rel_name should be followed and added.

pyramid_jsonapi.workflow.get_item(view, item_or_id=None)[source]

Wrapper around view.get_item() to allow passing an item or an id.

pyramid_jsonapi.workflow.get_jsonapi_accepts(request)[source]

Return a set of all ‘application/vnd.api’ parts of the accept header.

pyramid_jsonapi.workflow.make_method(name, api)[source]
pyramid_jsonapi.workflow.partition(items, predicate=<class 'bool'>)[source]
pyramid_jsonapi.workflow.partition_doc_data(doc_data, partitioner)[source]
pyramid_jsonapi.workflow.patch_rel_new_data(view, src_type, src_id, rel, rel_dict, stage)[source]
pyramid_jsonapi.workflow.permission_handler(endpoint_name, stage_name)[source]
pyramid_jsonapi.workflow.rel_patch_to_actions(view, src_id, rel, rel_patch_data)[source]

Split a patch to a to_many rel into post and delete. Return a to_one patch.

pyramid_jsonapi.workflow.sh_alter_document_add_denied(doc, view, stage, view_method)[source]
pyramid_jsonapi.workflow.sh_alter_document_add_returned_count(doc, view, stage, view_method)[source]

Add the returned count to meta.

pyramid_jsonapi.workflow.sh_alter_document_debug_info(doc, view, stage, view_method)[source]

Potentially add some debug information.

Include a self link unless the method is PATCH.

pyramid_jsonapi.workflow.sh_alter_request_add_info(request, view, stage, view_method)[source]

Add information commonly used in view operations.

pyramid_jsonapi.workflow.sh_validate_request_common_validity(request, view, stage, view_method)[source]

Perform common request validity checks.

pyramid_jsonapi.workflow.sh_validate_request_headers(request, view, stage, view_method)[source]

Check that request headers comply with spec.

Raises
  • HTTPUnsupportedMediaType

  • HTTPNotAcceptable

pyramid_jsonapi.workflow.sh_validate_request_object_exists(request, view, stage, view_method)[source]

Make sure that id exists in collection for all urls specifying an id.

pyramid_jsonapi.workflow.sh_validate_request_valid_json(request, view, stage, view_method)[source]

Check that the body of any request is valid JSON.

Raises

HTTPBadRequest

pyramid_jsonapi.workflow.shp_collection_post_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_delete_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_get_alter_document(doc, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_patch_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_relationships_delete_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_relationships_patch_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.shp_relationships_post_alter_request(request, view, stage, view_method)[source]
pyramid_jsonapi.workflow.wrapped_query_all(query)[source]

Wrap query.all() so that SQLAlchemy exceptions can be transformed to http ones.