Commit fa3ebedf authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Apply pylint rules on and

parent b1d537f3
......@@ -7,23 +7,27 @@ from gluon import current
from plugin_dbui import CALLBACK_ERRORS, get_where_query
"Can't delete this record since several transactions refer to it."
"""Inhibit the delete when at least one history row uses
the reference field.
@type set: gluon.dal.Set
@param set:
@type myset: gluon.dal.Set
@param myset:
@rtype: bool
db, T = current.globalenv['db'], current.T
field = set.query.first
field = myset.query.first
# protection
# the query of the set should be " == 45"
if field._db._adapter.EQ != set.query.op:
if field._db._adapter.EQ != myset.query.op:
return False
# protection
......@@ -40,11 +44,10 @@ def INHIBIT_CASCADE_DELETE(set):
# inhibit the delete if at least one history row use the reference field
query = get_where_query(db.history)
query = (query) & (set.query)
query = (query) & (myset.query)
if db(query).count():
field._table[CALLBACK_ERRORS] = \
T("Can't delete this record since several transactions refer to it.")
return True
return False
\ No newline at end of file
return False
......@@ -11,7 +11,6 @@ class IS_IN_USET(IS_IN_SET):
"""IS_IN_SET validator but working with unicode string.
def __init__(self, theset, **kwargs):
myset = []
......@@ -32,7 +31,6 @@ class IS_IN_USET(IS_IN_SET):
IS_IN_SET.__init__(self, myset, **kwargs)
def __call__(self, value):
if isinstance(value, unicode):
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