Skip to content

Commit

Permalink
Removed validate() decorator (deprecated since 0.10)
Browse files Browse the repository at this point in the history
  • Loading branch information
defnull committed Mar 22, 2013
1 parent 2d20c98 commit 3982dc2
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2398,27 +2398,6 @@ def path_shift(script_name, path_info, shift=1):
return new_script_name, new_path_info


def validate(**vkargs):
"""
Validates and manipulates keyword arguments by user defined callables.
Handles ValueError and missing arguments by raising HTTPError(403).
"""
depr('Use route wildcard filters instead.')
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kargs):
for key, value in vkargs.items():
if key not in kargs:
abort(403, 'Missing parameter: %s' % key)
try:
kargs[key] = value(kargs[key])
except ValueError:
abort(403, 'Wrong parameter format for: %s' % key)
return func(*args, **kargs)
return wrapper
return decorator


def auth_basic(check, realm="private", text="Access denied"):
''' Callback decorator to require HTTP auth (basic).
TODO: Add route(check_auth=...) parameter. '''
Expand Down

0 comments on commit 3982dc2

Please sign in to comment.