Skip to content

Commit

Permalink
Fix detection when decorators present
Browse files Browse the repository at this point in the history
Ensures that the 'db' keyword parameter is correctly detected even when
other decorators are applied to the function. Fixes bottlepy#21 as discussed
there.
  • Loading branch information
dansme committed Jan 16, 2022
1 parent fce1bb9 commit c469a46
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bottle_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ def apply(self, callback, route):

# Test if the original callback accepts a 'db' keyword.
# Ignore it if it does not need a database handle.
argspec = inspect.getargspec(_callback)
if keyword not in argspec.args:
params = inspect.signature(_callback).parameters

if keyword not in params:
return callback

def wrapper(*args, **kwargs):
Expand Down

0 comments on commit c469a46

Please sign in to comment.