Commit 0be96128 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Sphinx documentation for the module reporting_tools.

parent e29e71c3
reporting_tools.format_publication
==================================
.. currentmodule:: reporting_tools
.. autofunction:: format_publication
\ No newline at end of file
reporting_tools.get_converter
=============================
.. currentmodule:: reporting_tools
.. autofunction:: get_converter
\ No newline at end of file
reporting_tools.get_sections
============================
.. currentmodule:: reporting_tools
.. autofunction:: get_sections
\ No newline at end of file
reporting_tools.ref_url
=======================
.. currentmodule:: reporting_tools
.. autofunction:: ref_url
\ No newline at end of file
reporting_tools.repr_team_project
=================================
.. currentmodule:: reporting_tools
.. autofunction:: repr_team_project
\ No newline at end of file
......@@ -82,8 +82,24 @@ fields content.
.. autosummary::
:toctree: generated/
~REG_COLLABORATION
~REG_CONF_DATES
~REG_DEFENSE
~REG_SUBMITTED
reporting
^^^^^^^^^
A collection of tools to build the list of publications and to faciliatate
the reporting in controllers.
.. currentmodule:: reporting_tools
.. autosummary::
:toctree: generated/
~format_publication
~get_converter
~get_sections
~ref_url
~repr_team_project
......@@ -13,12 +13,11 @@ def clean(value, template, record):
"""Clean the representation of the record by removing typography mistakes.
Args:
value (unicode): the current string representing the record.
value (unicode): the bibliographic string representing the record.
template (unicode): the template string to be applied to the value
template (unicode): the template string is applied to the record
in order to obtain a new representation. The substitution
mechanism is: ``"{tablename.fieldname}"`` or
``"{referencetablename.fieldname}"``.
mechanism is: ``{tablename.fieldname}``.
record (gluon.dal.Row): the database row to be manipulated.
It contains the table *publications* and all foreign tables.
......@@ -39,10 +38,9 @@ def highlight_my_authors(value, template, record):
Args:
value (unicode): the current string representing the record.
template (unicode): the template string to be applied to the value
template (unicode): the template string is applied to the record
in order to obtain a new representation. The substitution
mechanism is: ``"{tablename.fieldname}"`` or
``"{referencetablename.fieldname}"``.
mechanism is: ``{tablename.fieldname}``.
record (gluon.dal.Row): the database row to be manipulated.
It contains the table *publications* and all foreign tables.
......@@ -68,10 +66,9 @@ def highlight_my_speaker(value, template, record):
Args:
value (unicode): the current string representing the record.
template (unicode): the template string to be applied to the value
template (unicode): the template string is applied to the record
in order to obtain a new representation. The substitution
mechanism is: ``"{tablename.fieldname}"`` or
``"{referencetablename.fieldname}"``.
mechanism is: ``{tablename.fieldname}``.
record (gluon.dal.Row): the database row to be manipulated.
It contains the table *publications* and all foreign tables.
......@@ -104,10 +101,9 @@ def remove_undef(value, template, record):
Args:
value (unicode): the current string representing the record.
template (unicode): the template string to be applied to the value
template (unicode): the template string is applied to the record
in order to obtain a new representation. The substitution
mechanism is: ``"{tablename.fieldname}"`` or
``"{referencetablename.fieldname}"``.
mechanism is: ``{tablename.fieldname}``.
record (gluon.dal.Row): the database row to be manipulated.
It contains the table *publications* and all foreign tables.
......
"""a collection of tools to build reports in controllers.
@author: R. Le Gac
"""A collection of tools to build reports in controllers.
"""
import re
......@@ -15,19 +13,19 @@ from gluon.storage import Storage
def format_publication(template, record, funcs=[]):
"""Build the bibliographic string for the publication.
@type template str:
@param template str:
@type record: gluon.DAL.Row
@param record
"""Build the bibliographic string for the *record*.
@type funcs: list
@param funcs: list of functions to polish the bibliographic reference
Args:
template (str): template to build the bibliographic string.
The database fields are identified by the pattern
``{tablename.fieldname}``. They will be replace by the
corresponding value found in the *record*.
record (gluon.DAL.Row): entry of the publications table.
funcs (list): list of reference to functions. They are used to polish
the bibliographic string.
@rtype: str
@return: the bibliographic reference
Returns:
str: the bibliographic reference
"""
# format the record according to user requirement
......@@ -42,14 +40,13 @@ def format_publication(template, record, funcs=[]):
def get_converter(row):
"""Get the converter dictionary for the axis label of the C{list}.
"""Get the converter dictionary for the axis label of the *list*.
@type row: gluon.dal.Row
@param row: One row of the database table C{list}.
Args:
row (gluon.dal.Row): one row of the database table *list*.
@rtype: dict
@return:
- C{value: "blabla, ....", value2: "foo", ....}
Returns:
dict: ``{value: "blabla, ....", value2: "foo", ....}``
"""
di = {}
......@@ -66,24 +63,20 @@ def get_converter(row):
def get_sections(db, selector, row):
"""Get the section rows for the C{list}.
@type db: gluon.dal.DAL
@param db:
@type selector: plugin_dbui.Selector
@param selector:
"""Get the section rows for the *list*.
@type row: gluon.dal.Row
@param row: One row of the database table C{list}.
Args:
db (gluon.dal.DAL): database connection
selector (plugin_dbui.Selector):
row (gluon.dal.Row): one row of the database table *list*.
@rtype: list
@return:
- a list of rows of the C{sections} table
- each row also contains the C{query} and C{orderby}
directive taking into account C{selector} directive.
- each row contains also the renderer format and post
processing functions
Returns:
list:
* A list of rows of the *sections* table.
* Each row also contains the *query* and *orderby*
directives taking into account *selector* criteria.
* Each row contains also the renderer format and post
processing functions
"""
publications = db.publications
......@@ -174,13 +167,14 @@ def get_sections(db, selector, row):
def ref_url(name='List'):
"""Get the URL string uses to build the current request.
@note: this function is useful in view
Note:
This function is useful in view
@type name: str
@param name:
Args:
name (str):
@rtype: str
@return: C{"http://..."}
Returns:
str: ``"http://..."``
"""
li = []
......@@ -199,14 +193,13 @@ def ref_url(name='List'):
def repr_team_project(db, selector):
"""Build the team/project string.
@type db: gluon.dal.DAL
@param db:
Args:
db (gluon.dal.DAL): database connection.
selector (plugin_dbui.Selector):
@type selector: plugin_dbui.Selector
@param selector:
Returns:
unicode: the pattern is "team" or "project" or "team/project".
@rtype: unicode
@return: the format is "team" or "project" or "team/project".
"""
s = ''
......
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