def dec(request, *args, **kwargs): if request.user.is_authenticated(): try: return view_func(request, *args, **kwargs) except Exception as e: LOG.error(traceback.format_exc()) if (getattr(e, 'http_status', None) and e.http_status == 401) or \ (getattr(e, 'status_code', None) and e.status_code == 401): return _logout(request) else: raise raise NotAuthenticated(_("Please log in to continue."))
def dec(request, *args, **kwargs): if request.user.is_authenticated(): return view_func(request, *args, **kwargs) raise NotAuthenticated(_("Please log in to continue."))