From 632db515019f98785fdf3f2d6fbe3c112931e90b Mon Sep 17 00:00:00 2001 From: Dmitry Nazarov Date: Fri, 9 Oct 2015 16:48:01 +0300 Subject: [PATCH] It is admitted as bad style to catch any exception: in that case you can not say what is the reason of crash when it happens. Also there is no need to check for exception here, if you just want to cut off anonymous users --- rest_auth/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rest_auth/views.py b/rest_auth/views.py index d789ac4..d335531 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -68,10 +68,8 @@ class LogoutView(APIView): permission_classes = (AllowAny,) def post(self, request): - try: + if not request.user.is_anonymous(): request.user.auth_token.delete() - except: - pass logout(request)