def anon_only(func): @wraps(func) def wrapped(*args, **kwargs): if g.user is not None: return redirect(url_for("index")) return func(*args, **kwargs) return wrapped