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:
parent
f55aeb96ad
commit
65e186de9b
|
@ -104,7 +104,17 @@ class SQLitePlugin(object):
|
|||
# Ignore it if it does not need a database handle.
|
||||
argspec = inspect.getargspec(_callback)
|
||||
if keyword not in argspec.args:
|
||||
return callback
|
||||
#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):
|
||||
# Connect to the database
|
||||
|
|
Loading…
Reference in New Issue
Block a user