def auth_basic(check, realm="private", text="Access denied"):
''' Callback decorator to require HTTP auth (basic).
TODO: Add route(check_auth=...) parameter. '''
def decorator(func):
def wrapper(*a, **ka):
user, password = request.auth or (None, None)
if user is None or not check(user, password):
err = HTTPError(401, text)
err.add_header('WWW-Authenticate', 'Basic realm="%s"' % realm)
return err
return func(*a, **ka)
return wrapper
return decorator
It doesn't use functools.wraps() on the nested wrapper function, which will stuff up name introspection for any functions which the decorator is applied to.
We have seen this affecting data reported by customers applications into New Relic. We are going to change our instrumentation to fix up the bottle code if we see it is wrong, but you should look at fixing it all the same.
The text was updated successfully, but these errors were encountered:
The implementation is:
It doesn't use functools.wraps() on the nested wrapper function, which will stuff up name introspection for any functions which the decorator is applied to.
We have seen this affecting data reported by customers applications into New Relic. We are going to change our instrumentation to fix up the bottle code if we see it is wrong, but you should look at fixing it all the same.
The text was updated successfully, but these errors were encountered: