Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
w2pext
plugin_dbui
Commits
94c352be
Commit
94c352be
authored
Apr 11, 2015
by
legac
Browse files
Replace (rtype, return) by returns
parent
85e0cb0d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
91 additions
and
96 deletions
+91
-96
modules/plugin_dbui/converter.py
modules/plugin_dbui/converter.py
+2
-2
modules/plugin_dbui/dbsvc.py
modules/plugin_dbui/dbsvc.py
+23
-23
modules/plugin_dbui/directsvc.py
modules/plugin_dbui/directsvc.py
+10
-8
modules/plugin_dbui/extjs.py
modules/plugin_dbui/extjs.py
+1
-1
modules/plugin_dbui/filters.py
modules/plugin_dbui/filters.py
+2
-2
modules/plugin_dbui/helper.py
modules/plugin_dbui/helper.py
+44
-46
modules/plugin_dbui/mapper.py
modules/plugin_dbui/mapper.py
+2
-4
modules/plugin_dbui/navtree.py
modules/plugin_dbui/navtree.py
+2
-2
modules/plugin_dbui/selector.py
modules/plugin_dbui/selector.py
+5
-8
No files found.
modules/plugin_dbui/converter.py
View file @
94c352be
...
...
@@ -195,7 +195,7 @@ def to_field(field, composite=True, linkedcombo=True, **kwargs):
class. They are applied in the following order:
constructor, modifiers and keyword arguments.
:ret
r
uns: Field or C{None}
:retu
r
ns: Field or C{None}
:note: Return None when composite is C{True} and when
the field is consumed by a C{FieldContainer}.
...
...
@@ -800,7 +800,7 @@ def to_treeNodes():
The Node structure is defined in the application model using
L{ViewportModifier}.
:r
type
: list
:r
eturns
: list
"""
cfg
=
[]
...
...
modules/plugin_dbui/dbsvc.py
View file @
94c352be
...
...
@@ -173,8 +173,8 @@ class DbSvc(BaseSvc):
"[table1.field1] belongs (1, 2, 3)"
"([table1.field1] == [table2.field2]) | ([table1.field2] == [table2.field1])"
:r
type: tuple of gluon.dal.Query
:return
:
:r
eturns:
tuple of gluon.dal.Query --
:
- the first element is the full query with all conditions or an empty string.
- the second element contains only the left join conditions or an empty string.
- the third element contains only the filter conditions or an empty string.
...
...
@@ -234,10 +234,10 @@ class DbSvc(BaseSvc):
:type id: int
:param id:
:r
type: dict
:return:
key, value pairs where each key corresponds
to a field of the table. Foreign keys are resolved.
The key are encoded as C{Table1Field1}.
:r
eturns:
dict --
key, value pairs where each key corresponds
to a field of the table. Foreign keys are resolved.
The key are encoded as C{Table1Field1}.
"""
db
=
current
.
globalenv
[
'db'
]
...
...
@@ -266,7 +266,7 @@ class DbSvc(BaseSvc):
:type field: gluon.dal.Field
:param field:
:r
type
: bool
:r
eturns
: bool
"""
return
field
in
current
.
globalenv
[
'db'
][
table
].
fields
...
...
@@ -283,10 +283,10 @@ class DbSvc(BaseSvc):
:param fields: key, value pairs where each key corresponds
to a C{gluon.dal.Field}
:r
type: dict
:return:
key, value pairs for each field with errors.
The key is encoded as C{Table1Field1} and the value is a string
describing the error message.
:r
eturns:
dict --
key, value pairs for each field with errors.
The key is encoded as C{Table1Field1} and the value is a string
describing the error message.
"""
di
=
{}
...
...
@@ -363,9 +363,9 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:r
type: gluon.storage.Storage
:return:
:r
eturns:
gluon.storage.Storage
- C{Storage(errors=[], records=[])}
- One to one correspondence between the errors
...
...
@@ -449,9 +449,9 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:r
type: dict
:return:
:r
eturns:
dict
- C{{success: True, records:[{Table1Field1: val, ... }, ... ],
msg: 'blalbla'}}
...
...
@@ -537,8 +537,8 @@ class DbSvc(BaseSvc):
- C{records} the list of C{id} for the records
to be deleted, C{[id1, id2, ... ]}.
:r
type: dict
:return:
:r
eturns:
dict
- C{{success: True, records:[{Table1Id1: id}, ...], msg: 'blalbla'}}
...
...
@@ -642,8 +642,8 @@ class DbSvc(BaseSvc):
- sort
- dir
:r
type: dict
:return:
:r
eturns:
dict
- C{{success: True, records: [{TableField: value, ...}, ...]}}
...
...
@@ -754,8 +754,8 @@ class DbSvc(BaseSvc):
- The keys are encoded as C{Table1Field1}.
:r
type: dict
:return:
:r
eturns:
dict
- C{{success: True, records:[{Table1Field1: val, ... }, ... ],
msg: 'blalbla'}}
...
...
modules/plugin_dbui/directsvc.py
View file @
94c352be
...
...
@@ -81,10 +81,12 @@ class DirectSvc(BaseSvc):
of the function / method on the server.
:rtype: str
:return:
- the response of the function / method run
on the server side
- the response is encoded as a JSON string.
:returns:
str --:
- the response of the function / method run
on the server side
- the response is encoded as a JSON string.
:raise gluon.http.HTTP: when the request has no arguments
or when the function / method crashed.
...
...
@@ -134,8 +136,8 @@ class DirectSvc(BaseSvc):
:type f: function
:r
type: function
:return: f
:r
eturns:
function -- the input argument
"""
...
...
@@ -157,8 +159,8 @@ class DirectSvc(BaseSvc):
"""Route the myrequest to the appropriate function / method,
pass the proper arguments and return the results.
:r
type: str
:return:
the response of the function / method
:r
eturns:
str --
the response of the function / method
encoded as a JSON string.
:raise gluon.http.HTTP:
...
...
modules/plugin_dbui/extjs.py
View file @
94c352be
...
...
@@ -168,7 +168,7 @@ class GridColumn(dict):
class
GridColumnModel
(
list
):
"""Configurator for C{Ext.grid.ColumnModel}.
:note:It is implemented as a C{list} of L{GridColumn}.
:note:
It is implemented as a C{list} of L{GridColumn}.
"""
...
...
modules/plugin_dbui/filters.py
View file @
94c352be
...
...
@@ -12,7 +12,7 @@ def CLEAN_COMMA(value):
:type value: str or unicode
:param value:
:r
type
: str or unicode
:r
eturns
: str or unicode
:note: return the value unchanged when it is not a string.
...
...
@@ -30,7 +30,7 @@ def CLEAN_SPACES(value):
:type value: str or unicode
:param value:
:r
type
: str or unicode
:r
eturns
: str or unicode
:note: return the value unchanged when it is not a string.
...
...
modules/plugin_dbui/helper.py
View file @
94c352be
...
...
@@ -32,7 +32,7 @@ def as_list(val):
:type val: any
:param val: input value
:r
type
: list
:r
eturns
: list
"""
if
not
isinstance
(
val
,
(
list
,
tuple
)):
...
...
@@ -66,7 +66,7 @@ def decode_field(field):
:type field: str
:r
type
: tuple
:r
eturns
: tuple
"""
li
=
[]
...
...
@@ -94,7 +94,7 @@ def dummy_row(table, value=''):
:type value: string
:param value: value associated to each field either an empty string of None
:r
type
: gluon.dal.Row
:r
eturns
: gluon.dal.Row
"""
db
=
table
.
_db
...
...
@@ -120,7 +120,7 @@ def encode_field(*args):
"""Encode the string arguments into a CapitalizeWords.
The reverse function is L{decode_field}.
:r
type
: str
:r
eturns
: str
:note: useful to build database field name like C{TableField}
or C{TableFieldFunc}.
...
...
@@ -142,9 +142,9 @@ def encode_validator_errors(error):
:param error: the key is the table field encode as C[TablenameFieldname]
while the value is the error message return by the validator
:r
type: dict
:return:
error message are translated and should be more friendly
since it contains the field name with its error.
:r
eturns:
dict --
error message are translated and should be more friendly
since it contains the field name with its error.
"""
di
=
{}
...
...
@@ -161,7 +161,7 @@ def get_all_tables(dal):
:type dal: gluon.dal.DAL
:param dal:
:r
type
: list
:r
eturns
: list
:note: It is recommend to use standard iterator provided by
the gluon.dal.DAL class. However by construction, they ignore
...
...
@@ -184,8 +184,7 @@ def get_create_id(table, **kwargs):
:type table: gluon.dal.Table
:rtype: int
:return: the C{id} of the record.
:returns: int -- the C{id} of the record.
"""
id
=
get_id
(
table
,
**
kwargs
)
...
...
@@ -202,10 +201,10 @@ def get_field_validators(field):
:type field: gluon.dal.Field
:r
type: dict
:return:
The keys depend on the validators.
Typical one are C{minValue}, C{maxValue}, C{regex}, C{regexText},
C{maxLength}, C{minLength}, ...
:r
eturns:
dict --
The keys depend on the validators.
Typical one are C{minValue}, C{maxValue}, C{regex}, C{regexText},
C{maxLength}, C{minLength}, ...
"""
cfg
=
{}
...
...
@@ -277,8 +276,7 @@ def get_file_paths(path, ext=None, alpha=True):
:type alpha: bool
:param alpha: sort the paths in alphabetic order
:rtype: list
:return: local paths for all selected files.
:returns: list -- local paths for all selected files.
"""
li
=
[]
...
...
@@ -311,8 +309,8 @@ def get_foreign_field(field):
:type field: gluon.dal.Field
:r
type: tuple
:return:
:r
eturns:
tuple
- C{(k_tablename, k_fieldname, k_keyname)}
...
...
@@ -370,8 +368,7 @@ def get_id(table, **kwargs):
:type table: gluon.dal.Table
:rtype: int or None
:return: the C{id} of the record.
:returns: int or None -- the C{id} of the record.
"""
query
=
None
...
...
@@ -394,8 +391,7 @@ def get_language():
"""Get the primary language of the application from the HTML
language code, I{i.e} C{en}, C{fr}, ....
:rtype: str
:return:
:returns: str
"""
lg
=
current
.
T
.
accepted_language
...
...
@@ -415,8 +411,9 @@ def get_plugin_path(plugin_name):
:type plugin_name: str
:param plugin_name: name of the plugin, I{i.e} C{"plugin_dbui"}.
:rtype: str
:return:
:returns:
str
- the path of the first directory starting with C{plugin_name}.
- the local path is relative to the application directory.
- C{None} if the plugin is not found.
...
...
@@ -443,8 +440,7 @@ def get_reference_paths():
- The local path is relative to the applications directory.
It is useful on the client-side
:rtype: tuple
:return: C{("applications/myapp", "/myapp")}
:returns: tuple -- C{("applications/myapp", "/myapp")}
"""
server_path
=
os
.
path
.
join
(
'applications'
,
current
.
request
.
application
)
...
...
@@ -459,7 +455,7 @@ def get_set_field(field):
:type field: gluon.dal.Field
:param field:
:r
type
: list
:r
eturns
: list
"""
validators
=
as_list
(
field
.
requires
)
...
...
@@ -500,7 +496,9 @@ def get_script_path(plugin):
:param plugin:
:rtype: str
:return:
:returns:
str
- the local path of the script file
- the local paths is relative to the application directory.
...
...
@@ -533,8 +531,7 @@ def get_store_id(name):
"""Build the store identifier using C{name}.
:type name: str
:rtype: str
:return: C{nameStore}
:returns: str -- C{nameStore}
"""
return
STOREID
%
name
...
...
@@ -543,9 +540,9 @@ def get_store_id(name):
def
get_versions
():
"""Get the versions of the application and plugins.
:r
type: list of dict
:return:
each dictionary contains the name of the software
and its version identifier. The keys are C{code} and C{version}
:r
eturns:
list of dict --
each dictionary contains the name of the software
and its version identifier. The keys are C{code} and C{version}
"""
server_path
,
client_path
=
get_reference_paths
()
...
...
@@ -644,8 +641,8 @@ def get_where_query(table):
:type table: gluon.dal.Table
:param table:
:r
type: gluon.dal.Query or None
:return:
C{None} when the table has no foreign key
:r
eturns:
gluon.dal.Query or None --
C{None} when the table has no foreign key
"""
db
=
table
.
_db
...
...
@@ -672,7 +669,7 @@ def is_foreign_field(field):
:type field: gluon.dal.Field
:param field:
:r
type
: bool
:r
eturns
: bool
"""
return
field
.
type
.
startswith
(
"reference"
)
...
...
@@ -681,8 +678,7 @@ def is_foreign_field(field):
def
is_mathjax
():
"""Return C{True} when the plugin mathjax is installed.
:rtype: bool
:return:
:returns: bool
"""
return
get_plugin_path
(
'plugin_mathjax'
)
!=
None
...
...
@@ -694,7 +690,7 @@ def is_set_field(field):
:type field: gluon.dal.Field
:r
type
: bool
:r
eturns
: bool
"""
validators
=
as_list
(
field
.
requires
)
...
...
@@ -712,7 +708,7 @@ def is_table_with_foreign_fields(table):
:type table: gluon.dal.Table
:r
type
: bool
:r
eturns
: bool
"""
for
field
in
table
:
...
...
@@ -727,12 +723,14 @@ def rows_serializer(rows):
table and where function are applied.
:type rows: gluon.dal.Rows
:rtype: list
:return:
- C{[{Table1Field1: val1,...}, {Table1Field1: val2,...}, ...]}
- A dictionary per row.
- Field are encoded as TableField.
- Field with an applied function like COUNT(table.field)
:returns:
list
* C{[{Table1Field1: val1,...}, {Table1Field1: val2,...}, ...]}
* A dictionary per row.
* Field are encoded as TableField.
* Field with an applied function like COUNT(table.field)
are encoded as TableFieldCount.
"""
...
...
modules/plugin_dbui/mapper.py
View file @
94c352be
...
...
@@ -10,8 +10,7 @@ def map_default(fields):
:type fields: list
:param fields: list of database field names
:rtype: list
:return: the input list
:returns: list -- the input list
"""
return
fields
...
...
@@ -25,8 +24,7 @@ def map_tabpanel(fieldsets):
:type fieldsets: list of FieldSet
:rtype: list
:return: the C{TapPanel} encapsulated in a list.
:returns: list -- the C{TapPanel} encapsulated in a list.
"""
...
...
modules/plugin_dbui/navtree.py
View file @
94c352be
...
...
@@ -82,8 +82,8 @@ class Node(object):
def
get_node
(
self
):
"""Get the dictionary defining the node.
:r
type: dict
:return:
:r
eturns:
dict
- C{text} (str): name of the node
...
...
modules/plugin_dbui/selector.py
View file @
94c352be
...
...
@@ -126,8 +126,7 @@ class Selector(Storage):
def
as_dict
(
self
):
"""Return the selector fields and their values.
:rtype: dict
:return:
:returns: dict
"""
di
=
{}
...
...
@@ -139,8 +138,7 @@ class Selector(Storage):
def
fields
(
self
):
"""Get the list of field names defined in the selector.
:rtype: list
:return:
:returns: list
"""
li
=
[]
...
...
@@ -161,7 +159,7 @@ class Selector(Storage):
:type table: gluon.dal.Table
:r
type
: gluon.dal.Query
:r
eturns
: gluon.dal.Query
"""
db
=
table
.
_db
...
...
@@ -202,8 +200,7 @@ class Selector(Storage):
def
repr_url
(
self
):
"""Get the URL string corresponding to the current request.
:rtype: str
:return:
:returns: str
"""
vars
=
[]
...
...
@@ -241,7 +238,7 @@ class Selector(Storage):
The keyword arguments are those of the
gluon.dal.Set.select method: orderby, groupby, ....
:r
type
: gluon.dal.Rows
:r
eturns
: gluon.dal.Rows
"""
db
=
table
.
_db
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment