Skip to content

Instantly share code, notes, and snippets.

@hahastudio
Created March 22, 2016 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hahastudio/426a750fb4c7a4beb210 to your computer and use it in GitHub Desktop.
Save hahastudio/426a750fb4c7a4beb210 to your computer and use it in GitHub Desktop.
a Flask decorator in https://www.v2ex.com/t/265346
def required(argName):
def decorator(f):
def wrapper(*args, **kwarg):
if request.args.get(argName):
return f(*args, **kwarg)
else:
abort()
return wrapper
return decorator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment