MCPcopy
hub / github.com/fluentpython/example-code-2e / wrapper

Function wrapper

21-async/mojifinder/bottle.py:2692–2698  ·  view source on GitHub ↗
(*a, **ka)

Source from the content-addressed store, hash-verified

2690 TODO: Add route(check_auth=...) parameter. '''
2691 def decorator(func):
2692 def wrapper(*a, **ka):
2693 user, password = request.auth or (None, None)
2694 if user is None or not check(user, password):
2695 err = HTTPError(401, text)
2696 err.add_header('WWW-Authenticate', 'Basic realm="%s"' % realm)
2697 return err
2698 return func(*a, **ka)
2699 return wrapper
2700 return decorator
2701

Callers

nothing calls this directly

Calls 6

HTTPErrorClass · 0.85
templateFunction · 0.85
add_headerMethod · 0.80
checkFunction · 0.50
copyMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected