Document

class DANE.Document(target, creator, api=None, _id=None, created_at=None, updated_at=None)

This is a class representation of a document in DANE, it holds both data and some logic.

Parameters:
  • target (dict) – Dict containing id, url, and type keys to described the target document.
  • creator (dict) – Dict containing id, and type keys to describe the document owner/creator.
  • api (base_classes.base_handler, optional) – Reference to a class:base_classes.base_handler which is used to communicate with the server.
  • _id (int, optional) – ID of the document, assigned by DANE-server
  • created_at – Creation date
  • updated_at – Last modified date
delete()

Delete this document. Requires an API to be set.

static from_json(json_str)

Constructs a DANE.Document instance from a JSON string

Parameters:json_str (str or dict) – Serialised DANE.Document
Returns:JSON string of the document
Return type:DANE.Document
getAssignedTasks(task_key=None)

Retrieve tasks assigned to this document. Accepts an optional task_key to filter for a specific type of tasks. Requires an API to be set.

Parameters:task_key (string, optional) – Key of task type to filter for
Returns:list of dicts with task keys and ids.
register()

Register this document in DANE, this will assign an _id to the document. Requires an API to be set.

Returns:self
set_api(api)

Set the API for the document

Parameters:api (base_classes.base_handler, optional) – Reference to a base_classes.base_handler which is used to communicate with the database, and queueing system.
Returns:self
to_json(indent=None)

Returns this document serialised as JSON, excluding the API reference.

Returns:JSON string of the document
Return type:str