Skip to content

Commit

Permalink
Merge pull request #5 from soderluk/fix-decorators
Browse files Browse the repository at this point in the history
Fix decorator arguments
  • Loading branch information
JonathanHuot committed Nov 30, 2018
2 parents 92bd9ed + b122c50 commit 1f6114a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bottle_oauthlib/oauth2.py
Expand Up @@ -137,7 +137,7 @@ def initialize(self, oauthlib_server, error_uri=None):
def create_token_response(self, credentials=None):
def decorator(f):
@functools.wraps(f)
def wrapper():
def wrapper(*args, **kwargs):
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"

# Get any additional creds
Expand All @@ -156,7 +156,7 @@ def wrapper():
set_response(bottle.request, bottle.response, resp_status,
resp_headers, resp_body)

func_response = f()
func_response = f(*args, **kwargs)
if func_response:
return func_response
return bottle.response
Expand All @@ -166,7 +166,7 @@ def wrapper():
def verify_request(self, scopes=None):
def decorator(f):
@functools.wraps(f)
def wrapper():
def wrapper(*args, **kwargs):
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"

# Get the list of scopes
Expand All @@ -185,7 +185,7 @@ def wrapper():
'scopes': req.scopes
})
if valid:
return f()
return f(*args, **kwargs)

# Framework specific HTTP 403
return HTTPError(403, "Permission denied")
Expand All @@ -195,7 +195,7 @@ def wrapper():
def create_introspect_response(self):
def decorator(f):
@functools.wraps(f)
def wrapper():
def wrapper(*args, **kwargs):
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"

uri, http_method, body, headers = extract_params(bottle.request)
Expand All @@ -209,7 +209,7 @@ def wrapper():
set_response(bottle.request, bottle.response, resp_status, resp_headers,
resp_body, force_json=True)

func_response = f()
func_response = f(*args, **kwargs)
if func_response:
return func_response
return bottle.response
Expand All @@ -219,7 +219,7 @@ def wrapper():
def create_authorization_response(self):
def decorator(f):
@functools.wraps(f)
def wrapper():
def wrapper(*args, **kwargs):
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"

uri, http_method, body, headers = extract_params(bottle.request)
Expand All @@ -239,7 +239,7 @@ def wrapper():
resp_headers, resp_body, resp_status = {}, e.json, e.status_code
set_response(bottle.request, bottle.response, resp_status, resp_headers, resp_body)

func_response = f()
func_response = f(*args, **kwargs)
if func_response:
return func_response
return bottle.response
Expand All @@ -249,7 +249,7 @@ def wrapper():
def create_revocation_response(self):
def decorator(f):
@functools.wraps(f)
def wrapper():
def wrapper(*args, **kwargs):
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"

uri, http_method, body, headers = extract_params(bottle.request)
Expand All @@ -263,7 +263,7 @@ def wrapper():

set_response(bottle.request, bottle.response, resp_status, resp_headers, resp_body)

func_response = f()
func_response = f(*args, **kwargs)
if func_response:
return func_response
return bottle.response
Expand Down

0 comments on commit 1f6114a

Please sign in to comment.