yawning_titan.db.doc_metadata.DocMetadata#

class yawning_titan.db.doc_metadata.DocMetadata(uuid=None, name=None, description=None, author=None, locked=False, created_at=None, updated_at=None)[source]#

Bases: object

A secure class to hold metadata related to a document in a Yawning-Titan TinyDB file.

The uuid and created_at attributes are set upon instantiation if they are not passed as params. Once set, they cannot be changed.

The DocMetadata constructor.

Parameters:
  • uuid – The documents globally unique identifier.

  • name – The name given to the document by the author.

  • description – The description given to the document by the author.

  • author – The original author of the document.

  • locked – Whether the doc is locked for editing or not.

  • created_at – The datetime the document was created at as an ISO 8601 str.

  • updated_at – The datetime the document was last updated at as an ISO 8601 str.

Methods

to_dict

Serialize the DocMetadata as a dict.

to_list

Get the doc metadata values as a list.

update

Updated the name, description, and author.

Attributes

author

The original author of the document.

created_at

The datetime the document was created at as an ISO 8601 str.

description

The description given to the document by the author.

locked

Whether the doc is locked for editing or not.

name

The name given to the document by the author.

updated_at

The datetime the document was last updated at as an ISO 8601 str.

uuid

The documents globally unique identifier.

property uuid#

The documents globally unique identifier.

property created_at#

The datetime the document was created at as an ISO 8601 str.

property locked#

Whether the doc is locked for editing or not.

property updated_at#

The datetime the document was last updated at as an ISO 8601 str.

property name#

The name given to the document by the author.

property description#

The description given to the document by the author.

property author#

The original author of the document.

update(name=None, description=None, author=None)[source]#

Updated the name, description, and author.

Parameters:
  • name – The name given to the document by the author.

  • description – The description given to the document by the author.

  • author – The original author of the document.

to_dict(include_none=False)[source]#

Serialize the DocMetadata as a dict.

Parameters:

include_none – Determines whether to include empty fields in the dict.

Returns:

The DocMetadata as a Python dict.

to_list()[source]#

Get the doc metadata values as a list.

Returns:

The values as a list of strings and None.