oldman.client.rest package


oldman.client.rest.controller module

class oldman.client.rest.controller.HTTPController(user_mediator, config={})[source]

Bases: object


TODO: check declared methods (only GET and HEAD are implicit).

DEFAULT_CONFIG = {'allow_put_new_resource': True, 'allow_put_new_type_existing_resource': False, 'allow_put_remove_type_existing_resource': False}
delete(hashless_iri, **kwargs)[source]

TODO: describe.

No declaration required.

get(hashless_iri, accept_header='*/*', **kwargs)[source]

TODO: describe.

No support declaration required.

head(hashless_iri, **kwargs)[source]

TODO: describe.

No support declaration required.

options(hashless_iri, **kwargs)[source]

TODO: implement it

patch(hashless_iri, content_type=None, payload=None, **kwargs)[source]

TODO: implement it

post(hashless_iri, content_type=None, payload=None, **kwargs)[source]

TODO: categorize the resource to decide what to do.

Support declaration and implementation are required.

put(hashless_iri, content_type=None, payload=None, **kwargs)[source]

TODO: describe.

No support declaration required.

oldman.client.rest.crud module

class oldman.client.rest.crud.HashLessCRUDer(user_mediator)[source]

Bases: object

A HashlessCRUDer object helps you to manipulate your Resource objects in a RESTful-like manner.

Please note that REST/HTTP only manipulates hash-less IRIs. A hash IRI is the combination of a hash-less IRI (fragment-less IRI) and a fragment. Multiple hashed IRIs may have the same hash-less IRI and only differ by their fragment values. This is a concern for each type of HTTP operation.

This class is generic and does not support the Collection pattern (there is no append method).

Parameters:managerResourceManager object.

Possible improvements:

  • Add a PATCH method.

Deletes every Resource object having this hash-less IRI.

Parameters:hashless_iri – Hash-less IRI.
get(hashless_iri, content_type='text/turtle')[source]

Gets the main Resource object having its hash-less IRI.

When multiple Resource objects have this hash-less IRI, one of them has to be selected. If one has no fragment value, it is selected. Otherwise, this selection is currently arbitrary.

TODO: stop selecting the resources and returns the graph containing these resources.

Raises an ObjectNotFoundError exception if no resource is found.

  • hashless_iri – hash-less of the resource.
  • content_type – Content type of its representation.

The representation of selected Resource object and its content type

update(hashless_iri, document_content, content_type, allow_new_type=False, allow_type_removal=False)[source]

Updates every Resource object having this hash-less IRI.

Raises an OMDifferentBaseIRIError exception if tries to create of modify non-blank Resource objects that have a different hash-less IRI. This restriction is motivated by security concerns.

Accepts JSON, JSON-LD and RDF formats supported by RDFlib.

  • hashless_iri – Document IRI.
  • document_content – Payload.
  • content_type – Content type of the payload.
  • allow_new_type – If True, new types can be added. Defaults to False. See oldman.resource.Resource.full_update() for explanations about the security concerns.
  • allow_type_removal – If True, new types can be removed. Same security concerns than above. Defaults to False.

Module contents