Commit 9616f34f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Sphinx documentation for the module callbacks.

parent 44c1c8e6
callbacks
---------
A collections of functions used in the database callback: ``_before_delete``,
``before_insert`` and ``_before_update``. They protect the database against
forbidden actions.
.. currentmodule:: callbacks
.. autosummary::
:toctree: generated/
~callbacks.INHIBIT_CASCADE_DELETE
~callbacks.INHIBIT_DUPLICATE_PUBLICATION
~callbacks.INHIBIT_HARVESTER_ON_CATEGORY
~callbacks.INHIBIT_PUBLICATION_DELETE_ON_OK
~callbacks.INHIBIT_PUBLICATION_UPDATE_ON_OK
callbacks.INHIBIT_CASCADE_DELETE
================================
.. currentmodule:: callbacks
.. autofunction:: INHIBIT_CASCADE_DELETE
\ No newline at end of file
callbacks.INHIBIT_DUPLICATE_PUBLICATION
=======================================
.. currentmodule:: callbacks
.. autofunction:: INHIBIT_DUPLICATE_PUBLICATION
\ No newline at end of file
callbacks.INHIBIT_HARVESTER_ON_CATEGORY
=======================================
.. currentmodule:: callbacks
.. autofunction:: INHIBIT_HARVESTER_ON_CATEGORY
\ No newline at end of file
callbacks.INHIBIT_PUBLICATION_DELETE_ON_OK
==========================================
.. currentmodule:: callbacks
.. autofunction:: INHIBIT_PUBLICATION_DELETE_ON_OK
\ No newline at end of file
callbacks.INHIBIT_PUBLICATION_UPDATE_ON_OK
==========================================
.. currentmodule:: callbacks
.. autofunction:: INHIBIT_PUBLICATION_UPDATE_ON_OK
\ No newline at end of file
......@@ -11,6 +11,7 @@ API Documentation
invenio
harvester
callbacks
Indices and tables
==================
......
"""a collections of functions to be used in _before_delete, before_insert
and _before_update callbacks.
@author: R. Le Gac
"""
from check_tools import (duplicate_article,
duplicate_conference,
......@@ -18,13 +16,13 @@ MSG_DUPLICATE = \
def INHIBIT_CASCADE_DELETE(set_records):
"""Inhibit the delete when publications use the reference field.
"""Inhibit the delete when the entry is referenced in another table(s).
@type set_records: gluon.dal.Set
@param set_records:
Args:
set_records (gluon.dal.Set): set object used for delete.
@rtype: bool
@return:
Returns:
bool: ``True`` when the delete is inhibited
"""
db, T = current.globalenv['db'], current.T
......@@ -64,11 +62,11 @@ def INHIBIT_CASCADE_DELETE(set_records):
def INHIBIT_DUPLICATE_PUBLICATION(publication):
"""Inhibit the insert operation when the publication already exists.
@type publication: dict
@param publication: publications fields passed to insert
Args:
publication (dict): publications fields passed to insert.
@rtype: bool
@return: C{True} when the insert is inhibited
Returns:
bool: ``True`` when the insert is inhibited
"""
db, T = current.globalenv['db'], current.T
......@@ -134,11 +132,11 @@ def INHIBIT_HARVESTER_ON_CATEGORY(harvester):
For a project, one automaton can only proceed publication
of the same code, e.g ACL or ACLN but not both
@type harvester: dict
@param harvester: harvester fields passed to insert
Args:
harvester (dict): harvester fields passed to insert.
@rtype: bool
@return: C{True} when the insert is inhibited
Returns:
bool: ``True`` when the insert is inhibited
"""
db, T = current.globalenv['db'], current.T
......@@ -173,11 +171,11 @@ def INHIBIT_HARVESTER_ON_CATEGORY(harvester):
def INHIBIT_PUBLICATION_DELETE_ON_OK(s):
"""Inhibit the delete operation when the status of the publication is OK.
@type s: gluon.dal.Set
@param s: Set object used for delete.
Args:
s (gluon.dal.Set]: set object used for delete.
@rtype: bool
@return: C{True} when the delete is inhibited
Returns:
bool: ``True`` when the delete is inhibited.
"""
db, T = current.globalenv['db'], current.T
......@@ -202,14 +200,12 @@ def INHIBIT_PUBLICATION_DELETE_ON_OK(s):
def INHIBIT_PUBLICATION_UPDATE_ON_OK(s, f):
"""Inhibit the update operation when the status of the publication is OK.
@type s: gluon.dal.Set
@param s: Set object used for update.
@type f: dict
@param f: the dict of publications fields passed to update
Args:
s (gluon.dal.Set): set object used for update.
f (dict): the dict of publications fields passed to update.
@rtype: bool
@return: C{True} when the update is inhibited
Returns:
bool: ``True`` when the update is inhibited.
"""
db, T = current.globalenv['db'], current.T
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment