Added a code to get into 1st level of closure in case of other decorator (like views) has wrapped the function and miss the the keyword detection. tested 0.12 & 0.13.

This commit is contained in:
Benoit Masson 2017-01-09 01:41:03 +01:00
parent f55aeb96ad
commit 65e186de9b

View File

@ -104,6 +104,16 @@ class SQLitePlugin(object):
# Ignore it if it does not need a database handle.
argspec = inspect.getargspec(_callback)
if keyword not in argspec.args:
#check for closure
no_keyword_arg = True
for closure in _callback.func_closure:
contents = closure.cell_contents
if callable(contents):
argspec = inspect.getargspec(contents)
if keyword in argspec.args:
no_keyword_arg = False
break
if no_keyword_arg:
return callback
def wrapper(*args, **kwargs):