web_tools submodule

Functions shared by the server script and also by the backend.

exception storage.web_tools.PrivatePublicationError

Bases: exceptions.UserWarning

Indication that publication is private.

storage.web_tools.compose_path(pub, uuid_url=False)

Compose absolute path for given pub.

Parameters:
  • pub (obj) – DBPublication instance.
  • uuid_url (bool, default False) – Compose URL using UUID.
Returns:

Absolute url-path of the publication, without server’s address and protocol.

Return type:

str

Raises:

PrivatePublicationError – When the pub is private publication.

storage.web_tools.compose_tree_path(tree, issn=False)

Compose absolute path for given tree.

Parameters:
  • pub (obj) – Tree instance.
  • issn (bool, default False) – Compose URL using ISSN.
Returns:

Absolute path of the tree, without server’s address and protocol.

Return type:

str

storage.web_tools.compose_full_url(pub, uuid_url=False)

Compose full url for given pub, with protocol, server’s address and port.

Parameters:
  • pub (obj) – DBPublication instance.
  • uuid_url (bool, default False) – Compose URL using UUID.
Returns:

Absolute url of the publication.

Return type:

str

Raises:

PrivatePublicationError – When the pub is private publication.

storage.web_tools.compose_tree_url(tree, issn_url=False)

Compose full url for given tree, with protocol, server’s address and port.

Parameters:
  • tree (obj) – Tree instance.
  • issn_url (bool, default False) – Compose URL using ISSN.
Returns:

URL of the tree

Return type:

str