Skip to content
Snippets Groups Projects
Commit 49296ae4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Review modifier.py documentation.

parent d55d8a6d
No related branches found
No related tags found
No related merge requests found
plugin_dbui.modifier.Modifier.configure
=======================================
.. currentmodule:: plugin_dbui.modifier
.. automethod:: Modifier.configure
\ No newline at end of file
plugin_dbui.modifier.Modifier
=============================
.. currentmodule:: plugin_dbui.modifier
.. autoclass:: Modifier
.. rubric:: Methods
.. autosummary::
:toctree: modifier/
~Modifier.configure
...@@ -12,37 +12,38 @@ MSG_INVALID_TYPE = "Invalid plugin type" ...@@ -12,37 +12,38 @@ MSG_INVALID_TYPE = "Invalid plugin type"
class Modifier(object): class Modifier(object):
"""Base class to construct Modifier tools. """Base class to construct Modifier tools.
Attributes: Args:
data (gluon.storage.Storage): dpname (str): name of the data point.
tablename (str):name of the database table.
""" Notes:
* A modifier stores its instructions in a global buffer
handles by the web2py ``PluginManager``.
def __init__(self, dpname, tablename=None): * The instructions are kept in a ``gluon.storage.Storage``.
"""Create the ``gluon.storage.Storage`` in the plugin dbui to house Its path is defined by the ``dpname`` and ``tablename`` arguments.
modifier information.
* The path to access to the Storage is defined by the ``dpname`` * The storage can be accessed from anywhere::
and ``tablename``.
* The ``Storage`` is linked to the class attribute ``data``.
* The ``Storage`` can be accessed outside the modifier
in the following way::
p = PluginManager('dbui') p = PluginManager('dbui')
modifier = p.dbui[dpname] modifier = p.dbui[dpname]
or when the tablename is defined:: or when the ``tablename`` is defined::
p = PluginManager('dbui') p = PluginManager('dbui')
modifier = p.dbui[dpname][tablename] modifier = p.dbui[dpname][tablename]
* The ``Storage`` contains the ``extjs`` key to store Attributes:
configuration parameter of the associate Ext JS widget. data (gluon.storage.Storage): contains all the instructions.
It has one key/attribute:
Args: * **extjs** to store configuration options
dpname (str): name of the data point. of the associate Ext JS widget.
tablename (str):name of the database table.
"""
def __init__(self, dpname, tablename=None):
"""
p = PluginManager('dbui') p = PluginManager('dbui')
if tablename: if tablename:
...@@ -64,7 +65,10 @@ class Modifier(object): ...@@ -64,7 +65,10 @@ class Modifier(object):
def configure(self, **extjs): def configure(self, **extjs):
"""Set the configuration parameters for the associated Ext JS widget. """Set the configuration parameters for the associated Ext JS widget.
.. note:: Keyword Args:
**extjs: any configuration options of the associated Ext JS widget.
Notes:
* Existing value of the configuration parameters are replaced by * Existing value of the configuration parameters are replaced by
those defined in the keyword arguments. those defined in the keyword arguments.
...@@ -75,9 +79,9 @@ class Modifier(object): ...@@ -75,9 +79,9 @@ class Modifier(object):
If a plugin with the same ptype alsready exists in the list If a plugin with the same ptype alsready exists in the list
it is replaced by the new definition. it is replaced by the new definition.
* A plugin is defined by a string containing is ``pType``. * A plugin can be defined by a string containing is ``pType``.
* A plugin is defined by a dictionary containing the ``pType`` * A plugin can be defined by a dictionary containing the ``pType``
and the plugin configuration options:: and the plugin configuration options::
{'ptype': foo, 'option1': val,...} {'ptype': foo, 'option1': val,...}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment