def __get__(self, request, obj_type=None): if not hasattr(request, '_newauth_cached_user'): from newauth.api import get_user_from_request request._newauth_cached_user = get_user_from_request(request) return request._newauth_cached_user
def _wrapped_view(request, *args, **kwargs): if test_func(get_user_from_request(request)): return view_func(request, *args, **kwargs) path = urlquote(request.get_full_path()) tup = login_url, redirect_field_name, path return HttpResponseRedirect("%s?%s=%s" % tup)