Skip to content

Commit 1f6114a

Browse files
authored
Merge pull request #5 from soderluk/fix-decorators
Fix decorator arguments
2 parents 92bd9ed + b122c50 commit 1f6114a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

bottle_oauthlib/oauth2.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def initialize(self, oauthlib_server, error_uri=None):
137137
def create_token_response(self, credentials=None):
138138
def decorator(f):
139139
@functools.wraps(f)
140-
def wrapper():
140+
def wrapper(*args, **kwargs):
141141
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"
142142

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

159-
func_response = f()
159+
func_response = f(*args, **kwargs)
160160
if func_response:
161161
return func_response
162162
return bottle.response
@@ -166,7 +166,7 @@ def wrapper():
166166
def verify_request(self, scopes=None):
167167
def decorator(f):
168168
@functools.wraps(f)
169-
def wrapper():
169+
def wrapper(*args, **kwargs):
170170
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"
171171

172172
# Get the list of scopes
@@ -185,7 +185,7 @@ def wrapper():
185185
'scopes': req.scopes
186186
})
187187
if valid:
188-
return f()
188+
return f(*args, **kwargs)
189189

190190
# Framework specific HTTP 403
191191
return HTTPError(403, "Permission denied")
@@ -195,7 +195,7 @@ def wrapper():
195195
def create_introspect_response(self):
196196
def decorator(f):
197197
@functools.wraps(f)
198-
def wrapper():
198+
def wrapper(*args, **kwargs):
199199
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"
200200

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

212-
func_response = f()
212+
func_response = f(*args, **kwargs)
213213
if func_response:
214214
return func_response
215215
return bottle.response
@@ -219,7 +219,7 @@ def wrapper():
219219
def create_authorization_response(self):
220220
def decorator(f):
221221
@functools.wraps(f)
222-
def wrapper():
222+
def wrapper(*args, **kwargs):
223223
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"
224224

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

242-
func_response = f()
242+
func_response = f(*args, **kwargs)
243243
if func_response:
244244
return func_response
245245
return bottle.response
@@ -249,7 +249,7 @@ def wrapper():
249249
def create_revocation_response(self):
250250
def decorator(f):
251251
@functools.wraps(f)
252-
def wrapper():
252+
def wrapper(*args, **kwargs):
253253
assert self._oauthlib, "BottleOAuth2 not initialized with OAuthLib"
254254

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

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

266-
func_response = f()
266+
func_response = f(*args, **kwargs)
267267
if func_response:
268268
return func_response
269269
return bottle.response

0 commit comments

Comments
 (0)