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

Run pylint checker on plugin_dbui/callback.py

parent 335d7001
No related branches found
No related tags found
2 merge requests!15Release 0.7.3,!1014 pylint jslint
......@@ -7,39 +7,39 @@ from dbsvc import CALLBACK_ERRORS
from gluon import current
def INHIBIT_DELETE_UNDEF(set):
def INHIBIT_DELETE_UNDEF(setrows):
"""Inhibit the delete of the record containing the undefined value.
Args:
set (gluon.dal.Set):
setrows (gluon.dal.Set):
set of records used for deleted
Returns:
true when the record contains the undefined value.
"""
db, T = current.globalenv['db'], current.T
field = set.query.first
T = current.T
field = setrows.query.first
# protection
# the query of the set should be "table.id == 1"
if field._db._adapter.EQ != set.query.op:
if field._db._adapter.EQ != setrows.query.op:
return False
# inhibit the delete
if field.name == 'id' and set.query.second == UNDEF_ID:
if field.name == 'id' and setrows.query.second == UNDEF_ID:
field._table[CALLBACK_ERRORS] = \
T("You can not delete the row containing the undefined value.")
T("You can not delete the row containing the undefined value.")
return True
return False
def INHIBIT_UPDATE_UNDEF(set, values):
def INHIBIT_UPDATE_UNDEF(setrows, values):
"""Inhibit the update the row containing the undefined value.
Args:
set (gluon.dal.Set):
setrows (gluon.dal.Set):
set of records for update
values (dict):
......@@ -49,18 +49,18 @@ def INHIBIT_UPDATE_UNDEF(set, values):
true when the record contains the undefined value.
"""
db, T = current.globalenv['db'], current.T
field = set.query.first
T = current.T
field = setrows.query.first
# protection
# the query of the set should be "table.id == 1"
if set.query.op != field._db._adapter.EQ:
if setrows.query.op != field._db._adapter.EQ:
return False
# inhibit the delete
if field.name == 'id' and int(set.query.second) == UNDEF_ID:
if field.name == 'id' and int(setrows.query.second) == UNDEF_ID:
field._table[CALLBACK_ERRORS] = \
T("You can not update the row containing the undefined value.")
T("You can not update the row containing the undefined value.")
return True
return False
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