Module Expr Str ImportFrom alias ImportFrom alias Import alias ImportFrom alias Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias Import alias Import alias ImportFrom alias FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args defaults vararg kwarg body If UnaryOpNot Call AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str keyword AttributeLoad AttributeLoad NameLoad attr attr Return Call NameLoad NameLoad NameLoad decorator_list Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str FunctionDef arguments args defaults vararg kwarg body If Call AttributeLoad NameLoad attr body If UnaryOpNot Call AttributeLoad NameLoad attr body Expr Call NameLoad Num Return Call NameLoad NameLoad NameLoad Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str keyword AttributeLoad AttributeLoad NameLoad attr attr decorator_list Call NameLoad NameLoad Return NameLoad decorator_list Expr Str
N/A N/A 
decorators.py

Decorators for URL handlers

 google.appengine.ext ndb google.appengine.api users N/A functools functools wraps N/A flask N/A util flask g flaskext login flaskext oauth N/A model N/A config application app login_required N/A N/A func N/A N/A N/A Requires standard login credentials decorated_view N/A N/A N/A args kwargs N/A N/A N/A N/A N/A users get_current_user N/A N/A N/A N/A flask url_for N/A N/A flask url_for signin next N/A N/A flask request url N/A N/A func args kwargs N/A N/A wraps func N/A decorated_view N/A admin_required N/A N/A func N/A N/A N/A Requires App Engine admin credentials decorated_view N/A N/A N/A args kwargs N/A N/A N/A N/A users is_authenticated N/A N/A N/A N/A N/A users is_current_user_admin N/A N/A N/A abort 401 N/A N/A func args kwargs N/A N/A N/A flask url_for N/A N/A flask url_for signin next N/A N/A flask request url N/A N/A wraps func N/A decorated_view N/A N/A 
def login_required(f):
  @functools.wraps(f)
  def decorated_function(*args, **kws):
    if is_logged_in():
      return f(*args, **kws)
    if flask.request.path.startswith('/_s/'):
      return flask.abort(401)
    return flask.redirect(flask.url_for('signin', next=flask.request.url))
  return decorated_function


def admin_required(f):
  @functools.wraps(f)
  def decorated_function(*args, **kws):
    if is_logged_in() and current_user_db().admin:
      return f(*args, **kws)
    if not is_logged_in() and flask.request.path.startswith('/_s/'):
      return flask.abort(401)
    if not is_logged_in():
      return flask.redirect(flask.url_for('signin', next=flask.request.url))
    return flask.abort(403)
  return decorated_function
