hilbert/decorators.py
def anonymous_required(func=None, url=None):
    """Required that the user is not logged in."""

    url = url or "/"

    def _dec(view_func):
        @wraps(view_func, assigned=available_attrs(view_func))
        def _wrapped_view(request, *args, **kwargs):
            if request.user.is_authenticated():
                return redirect(url)
            else:
                return view_func(request, *args, **kwargs)
        return _wrapped_view

    if func is None:
        return _dec
    else:
        return _dec(func)
Required that the user is not logged in.
Required that the user is not logged in.
Required that the user is not logged in .
def anonymous_required(func=None, url=None):
    url = url or "/"
    def _dec(view_func):
        @wraps(view_func, assigned=available_attrs(view_func))
        def _wrapped_view(request, *args, **kwargs):
            if request.user.is_authenticated():
                return redirect(url)
            else:
                return view_func(request, *args, **kwargs)
        return _wrapped_view
    if func is None:
        return _dec
    else:
        return _dec(func)
def anonymous_required ( func = None , url = None ) : url = url or "/" def _dec ( view_func ) : @ wraps ( view_func , assigned = available_attrs ( view_func ) ) def _wrapped_view ( request , * args , ** kwargs ) : if request . user . is_authenticated ( ) : return redirect ( url ) else : return view_func ( request , * args , ** kwargs ) return _wrapped_view if func is None : return _dec else : return _dec ( func )
Required that the user is not logged in.
Required that the user is not logged in .
"""Required that the user is not logged in."""
func
url