Commit 8e04b31d authored by legac's avatar legac
Browse files

Fix the L{...} construct.

parent f19fad95
""" a series of converter to transform L{gluon.dal} objects into Ext JS widgets.
""" a series of converter to transform *gluon.dal* objects into Ext JS widgets.
"""
import gluon.dal
......@@ -48,9 +48,10 @@ X_LINKED_COMBO = ['xcomboboxmaster', 'xcomboboxslave']
def _to_field(field, linkedcombo=True, **kwargs):
"""Build the L{Field} configuration associated to the database ``field``.
The conversion takes into account the L{FieldsModifier} instructions
but does not handle ``FieldContainer``.
"""Build the :class:`plugin_dbui.extjs.Field` configuration associated
to the database ``field``. The conversion takes into account the
:class:`plugin_dbui.fieldmodifier.FieldsModifier` instructions
but does not handle :class:`plugin_dbui.extjs.FieldContainer`.
:type field: gluon.dal.Field
:param field:
......@@ -65,17 +66,20 @@ def _to_field(field, linkedcombo=True, **kwargs):
``Ext.form.Field`` class. They are applied in the following order:
constructor, modifiers and keyword arguments.
:returns: Field
:returns: :class:`plugin_dbui.extjs.Field`
:note:
The return configurator is a L{Field}. However it can be a
L{ComboBox}, a L{FieldDate}, a L{FieldTextArea}, ...
The return configurator is a :class:`plugin_dbui.extjs.Field`.
However it can be a :class:`plugin_dbui.extjs.ComboBox`,
a :class:`plugin_dbui.extjs.FieldDate`,
a :class:`plugin_dbui.extjs.FieldTextArea`, ...
depending on the ``type`` of the database field.
The association is defined in the dictionary L{FTYPE_TO_XTYPE}.
The association is defined in the dictionary
:const:`FTYPE_TO_XTYPE`.
:attention:
It is recommended to used the more general method L{to_field}
which also understands ``FieldContainer``.
It is recommended to used the more general method :meth:`to_field`
which also understands :class:`plugin_dbui.extjs.FieldContainer`.
"""
T = current.T
......@@ -172,19 +176,25 @@ def _to_field(field, linkedcombo=True, **kwargs):
def to_field(field, composite=True, linkedcombo=True, **kwargs):
"""Build the L{Field} configuration for the database field.
The conversion handles L{FieldContainer} and takes into account
the ``FieldsModifier`` instructions.
"""Build the :class:`plugin_dbui.extjs.Field` configuration for
the database field. The conversion handles
:class:`plugin_dbui.extjs.FieldContainer` and takes into account
the :class:`plugin_dbui.fieldsmodifier.FieldsModifier` instructions.
:note:
The return configurator is a L{Field}. However it can be a
L{ComboBox}, a L{FieldDate}, a L{FieldTextArea}, ...
The return configurator is a :class:`plugin_dbui.extjs.Field`.
However it can be a :class:`plugin_dbui.extjs.ComboBox`,
a :class:`plugin_dbui.extjs.FieldDate`,
:class:`plugin_dbui.extjs.FieldTextArea`, ...
depending on the ``type`` of the database field.
The association is defined in the dictionary L{FTYPE_TO_XTYPE}.
The association is defined in the dictionary
:const:`FTYPE_TO_XTYPE`.
:note:
The database fields can be organized in L{FieldContainer}
in the application model using the modifiers L{FieldsModifier}.
The database fields can be organized in
:class:`plugin_dbui.extjs.FieldContainer` in the application
model using the modifiers
:class:`plugin_dbui.fieldsmodifier.FieldsModifier`.
:type field: gluon.dal.Field
:param field:
......@@ -205,10 +215,10 @@ def to_field(field, composite=True, linkedcombo=True, **kwargs):
class. They are applied in the following order:
constructor, modifiers and keyword arguments.
:returns: Field or ``None``
:returns:
:class:`plugin_dbui.extjs.Field` or ``None``
:note:
Return None when composite is ``True`` and when
Return ``None`` when composite is ``True`` and when
the field is consumed by a ``FieldContainer``.
"""
......@@ -250,26 +260,28 @@ def to_field(field, composite=True, linkedcombo=True, **kwargs):
def to_fields(table):
"""Build the list L{Field} configuration for each field
of the database ``table``.
"""Build the list :class:`plugin_dbui.extjs.Field` configuration
for each field of the database ``table``.
:note:
The return configuration is a L{Field}. However it can be a
L{ComboBox}, a L{FieldDate}, a L{FieldTextArea}, ...
depending on the ``type`` of the database field.
The association is defined in the dictionary L{FTYPE_TO_XTYPE}.
:note:
The function handles L{FieldSet} and L{FieldContainer}
as well as the L{FieldsModifier} instructions.
The ``FieldSet`` and ``FieldContainer`` can be defined in the application
model using the modifier L{FormModifier} and the L{FieldsModifier}
respectively.
The function handles :class:`plugin_dbui.extjs.FieldSet` and
:class:`plugin_dbui.extjs.FieldContainer` as well as the
:class:`plugin_dbui.fieldsmodifier.FieldsModifier` instructions.
The ``FieldSet`` and ``FieldContainer`` can be defined in the
application model using the modifier
:class:`plugin_dbui.formmodifier.FormModifier` and the
:class:`plugin_dbui.fieldsmodifier.FieldsModifier` respectively.
:type table: gluon.dal.Table
:param table:
:returns: list
:returns:
list
The list elements are :class:`plugin_dbui.extjs.Field`, but
it can be a :class:`plugin_dbui.extjs.ComboBox`,
a :class:`plugin_dbui.extjs.FieldDate`,
a :class:`plugin_dbui.extjs.FieldTextArea`, ...,
depending on the ``type`` of the database field.
"""
li = []
......@@ -335,8 +347,9 @@ def to_fields(table):
def to_formPanel(table, **kwargs):
"""Build the L{FormPanel} configuration for the database ``table``.
The conversion takes into account the L{FormModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.FormPanel` configuration
for the database ``table``. The conversion takes into account the
:class:`plugin_dbui.formmodifier.FormModifier` instructions.
:type table: gluon.dal.Table
:param table:
......@@ -348,7 +361,7 @@ def to_formPanel(table, **kwargs):
applied in the following order: constructor, modifiers
and keyword arguments.
:returns: FormPanel
:returns: :class:`plugin_dbui.extjs.FormPanel`
"""
tablename = table._tablename
......@@ -372,8 +385,9 @@ def to_formPanel(table, **kwargs):
def to_gridColumn(field, **kwargs):
"""Build the L{GridColumn} configuration for the database ``field``.
The conversion takes into account the L{GridModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.GridColumn` configuration
for the database ``field``. The conversion takes into account the
:class:`plugin_dbui.gridmodifier.GridModifier` instructions.
:type field: gluon.dal.Field
:param field:
......@@ -385,7 +399,7 @@ def to_gridColumn(field, **kwargs):
They are applied in the following order: constructor, modifiers
and keyword arguments.
:returns: GridColumn
:returns: :class:`plugin_dbui.extjs.GridColumn`
"""
T = current.T
......@@ -437,13 +451,14 @@ def to_gridColumn(field, **kwargs):
def to_gridColumnModel(table):
"""Build the L{GridColumnModel} configuration for the database ``table``.
The conversion takes into account the L{GridModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.GridColumnModel` configuration
for the database ``table``. The conversion takes into account the
:class:`plugin_dbui.gridmodifier.GridModifier` instructions.
:type table: gluon.dal.Table
:param table:
:returns: GridColumnModel
:returns: :class:`plugin_dbui.extjs.GridColumnModel`
"""
delete_columns = []
......@@ -479,8 +494,9 @@ def to_gridColumnModel(table):
def to_gridFilter(table, **kwargs):
"""Build the L{GridFilter} configuration for the database ``table``.
The GridFilter is parametrized using the L{GridModifier}.
"""Build the :class:`plugin_dbui.extjs.GridFilter` configuration for
the database ``table``. The ``GridFilter`` is parametrized using the
:class:`plugin_dbui.gridmodifier.GridModifier`.
:type table: gluon.dal.Table
:param table:
......@@ -490,24 +506,25 @@ def to_gridFilter(table, **kwargs):
any of the Ext JS configuration parameters of the
``App.grid.Filter`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
A filter rule is defined in the model via the
:class:`plugin_dbui.gridmodifier.GridModifier`.
The rule is a ``tuple`` containing 3 strings
``("field1", "operator", "comment")``
where ``field1`` is the name of a field belonging to the ``table``.
A more elaborate filter rule allows to filter on any foreign field using
the syntax is ``("table2.field1", "operator", "comments")``.
Valid operators are defined in the method
:meth:`plugin_dbui.dbsvc.DbSvc._encode_query`.
Rules are store in the modifier section ``grid_filters``.
:returns: GridFilter
:returns:
:class:`plugin_dbui.extjs.GridFilter`
:note:
Return an empty dictionary if the GridFilter is
not defined in the application model.
:note:
A filter rule is defined in the model via the L{GridModifier}.
The rule is a ``tuple`` containing 3 strings
``("field1", "operator", "comment")``
where ``field1`` is the name of a field belonging to the ``table``.
A more elaborate filter rule allows to filter on any foreign field using
the syntax is ``("table2.field1", "operator", "comments")``.
Valid operators are defined in the method L{dbsvc.DbSvc._encode_query}.
:note:
Rules are store in the modifier section ``grid_filters``.
"""
T = current.T
......@@ -599,8 +616,9 @@ def to_gridFilter(table, **kwargs):
def to_gridPanel(table, **kwargs):
"""Build the L{App.grid.Panel} configuration for the database ``table``.
The conversion takes into account the L{GridModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.GridPanel` configuration for
the database ``table``. The conversion takes into account the
:class:`plugin_dbui.gridmodifier.GridModifier` instructions.
:type table: gluon.dal.Table
:param table:
......@@ -611,7 +629,7 @@ def to_gridPanel(table, **kwargs):
``App.grid.Panel`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
:returns: GridPanel
:returns: :class:`plugin_dbui.extjs.GridPanel`
"""
tablename = table._tablename
......@@ -645,8 +663,9 @@ def to_gridPanel(table, **kwargs):
def to_jsonstore(table, **kwargs):
"""Build the L{DirectStore} configuration for the database ``table``.
The conversion takes into account the L{StoreModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.DirectStore` configuration for
the database ``table``. The conversion takes into account the
:class:`plugin_dbui.storemodifier.StoreModifier` instructions.
:type table: gluon.dal.Table
:param table:
......@@ -657,7 +676,7 @@ def to_jsonstore(table, **kwargs):
``App.data.DirectStore`` class. They are applied in the following order:
constructor, modifiers, keyword arguments.
:returns: DirectStore
:returns: :class:`plugin_dbui.extjs.DirectStore`
"""
db = table._db
......@@ -735,7 +754,8 @@ def to_jsonstore(table, **kwargs):
def to_model(table):
"""Build the L{Ext.data.Model} configuration for the database ``table``.
"""Build the :class:`plugin_dbui.extjs.Model` configuration for
the database ``table``.
:type table: gluon.dal.Table
:param table:
......@@ -782,7 +802,7 @@ def to_model(table):
def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
"""Build the L{PanelWithUrlSelector} configuration
"""Build the :class:`plugin_dbui.extjs.PanelWithUrlSelector` configuration
where the selector is a form derived from the database ``table``.
:type table: gluon.dal.Table
......@@ -805,7 +825,7 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
any of the Ext JS configuration parameters of the
``App.panel.WithUrlSelector`` class.
:returns: PanelWithUrlSelector
:returns: :class:`plugin_dbui.extjs.PanelWithUrlSelector`
:raise BaseException: when baseUrl is not defined.
......@@ -829,9 +849,9 @@ def to_panelWithUrlSelector(table, selectorTitle='Select', **kwargs):
def to_treeNodes():
"""Build the list of L{Node}.
"""Build the list of :class:`plugin_dbui.navtree.Node`.
The Node structure is defined in the application model using
L{ViewportModifier}.
:class:`plugin_dbui.viewportmodifier.ViewportModifier`.
:returns: list
......@@ -849,8 +869,9 @@ def to_treeNodes():
def to_viewport(**kwargs):
"""Build the ``Ext.Viewport`` configuration.
The conversion takes into account the L{ViewportModifier} instructions.
"""Build the :class:`plugin_dbui.extjs.Viewport` configuration.
The conversion takes into account the
:class:`plugin_dbui.viewportmodifier.ViewportModifier` instructions.
:type kwargs: dict
:keyword kwargs:
......
......@@ -35,12 +35,12 @@ class MyJsonEncoder(json.JSONEncoder):
class DirectSvc(BaseSvc):
"""Generic service to implement the
U{Ext.Direct<http://www.sencha.com/products/extjs/extdirect/>} protocol
`Ext.Direct <http://www.sencha.com/products/extjs/extdirect/>`_ protocol
on the server-side.
This implementation is based on the
U{web2py service<http://www.web2py.com/book/default/chapter/09>}
using a simplified version of the class L{gluon.tools.Service}.
`web2py service <http://www.web2py.com/book/default/chapter/09>`_
using a simplified version of the class ``gluon.tools.Service``.
To register functions and make them available on the client-side
use decorator::
......
......@@ -169,7 +169,7 @@ class GridColumn(dict):
class GridColumnModel(list):
"""Configurator for ``Ext.grid.ColumnModel``.
:note: It is implemented as a ``list`` of L{GridColumn}.
:note: It is implemented as a ``list`` of :class:`GridColumn`.
"""
......
......@@ -204,8 +204,8 @@ class FormModifier(Modifier):
def merge_fields(self, *fields, **kwargs):
"""Merge fields in a L{FieldSet} corresponding to
an ``Ext.form.FieldSet`` widget.
"""Merge fields in a :class:`plugin_dbui.extjs.FieldSet`
corresponding to the ``Ext.form.FieldSet`` widget.
Each ``field`` is either a string identifying the database field by its name
or an instance of the Ext JS configurator like the ``Spacer``.
......@@ -247,7 +247,7 @@ class FormModifier(Modifier):
field/fieldset. The function return a dictionary with the structure of
panels embedded in the form an the fields they contained.
Example of mapper can be found in the L{mapper} module.
Example of mapper can be found in the :mod:`plugin_dbui.mapper` module.
"""
self.data.mapper = func
\ No newline at end of file
......@@ -132,7 +132,8 @@ class GridModifier(Modifier):
However, the more elaborate syntax, ``'table2.field1'``,
allows to use foreign field.
* The operator, ``'=='``, ``'contains'``, ...
Valid operator are defined in the method L{dbsvc.DbSvc._encode_query}
Valid operator are defined in the method
:meth:`plugin_dbui.dbsvc.DbSvc._encode_query`
* The comment for the tool tip.
The keyword argument contains Ext JS configuration options
......@@ -166,7 +167,7 @@ class GridModifier(Modifier):
The latter is created automatically as soon as a filter is defined.
Filter are defined and tuned individually
using the method L{append_filter}.
using the method :meth:`append_filter`.
The keyword argument contains Ext JS configuration options
for the ``Ext.form.FieldSet``
......
......@@ -59,7 +59,7 @@ def close_user_session():
def decode_field(field):
"""Decode a string in CapitalizeWords into a list
of words where all words are in lower case.
The reverse function is L{encode_field}.
The reverse function is :meth:`encode_field`.
:note:
useful to decode database field name:
......@@ -120,7 +120,7 @@ def dummy_row(table, value=''):
def encode_field(*args):
"""Encode the string arguments into a CapitalizeWords.
The reverse function is L{decode_field}.
The reverse function is :meth:`decode_field`.
:returns: str
......@@ -642,7 +642,7 @@ def get_versions():
def get_where_query(table):
"""Build the L{gluon.dal.Query} resolving foreign keys
"""Build the ``gluon.dal.Query`` resolving foreign keys
for the ``table``.
:type table: gluon.dal.Table
......@@ -727,7 +727,7 @@ def is_table_with_foreign_fields(table):
def rows_serializer(rows):
"""Serialize a L{gluon.dal.Rows} as a list of dictionary.
"""Serialize a ``gluon.dal.Rows`` as a list of dictionary.
It handle the general case where field belongs to different
table and where function are applied.
......
......@@ -15,7 +15,7 @@ class Modifier(object):
"""
def __init__(self, dpname, tablename=None):
"""Create the L{gluon.storage.Storage} in the plugin dbui to house
"""Create the ``gluon.storage.Storage`` in the plugin dbui to house
modifier information.
* The path to access to the Storage is defined by the ``dpname``
......
......@@ -9,7 +9,7 @@ from gluon import current
class Node(object):
"""The ``node`` is the key element of the navigation tree.
It contains children (leaves) which are associated to widgets.
The widget will be display on the panel of the T(Viewport).
The widget will be display on the panel of the *Viewport*.
"""
def __init__(self, text):
......
......@@ -40,7 +40,7 @@ class Selector(Storage):
This class handle table and its reference field.
The basic query handles the selector constraints
and the inner join for reference field. Additional
constraints can also be added via the method L{append_query}.
constraints can also be added via the method :meth:`append_query`.
All fields of the selector are attributes of this class::
......@@ -156,7 +156,7 @@ class Selector(Storage):
* inner join for reference fields,
* selector constraints,
* extra queries added via the L{append_query} method.
* extra queries added via the :meth:`append_query` method.
* the ``extfield`` as well as fields in the ``exclude_fields``
tuple are not take into account in the query.
......
......@@ -13,7 +13,8 @@ MODIFIER_STORES = 'modifier_stores'
class AddStore(object):
""" A Ext JS store is associated to each database table. Their configuration
are derived from the table models using the L{converter.to_jsonstore}.
are derived from the table models using the
:func:`plugin_dbui.converter.to_jsonstore`.
The Ext JS configuration options of all stores are kept in a
persistent dictionary of the plugin_dbui.
......
......@@ -37,7 +37,8 @@ class ViewportModifier(Modifier):
* ``extjs`` (dict) Ext JS configuration options for the
viewport widget.
* ``nodes`` (list) list of L{Node} defining the navigation tree
* ``nodes`` (list) list of :class:`plugin_dbui.navtree.Node`
defining the navigation tree
"""
Modifier.__init__(self, MODIFIER_VIEWPORTS)
......@@ -50,9 +51,10 @@ class ViewportModifier(Modifier):
def add_node(self, *args):
"""Add a list of L{Node}s to the navigation tree.
"""Add a list of :class:`plugin_dbui.navtree.Node`s
to the navigation tree.
:type args: list of L{Node}
:type args: list of :class:`plugin_dbui.navtree.Node`
:param args:
:note:
......
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