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

This commit is contained in:
Dmitry Nazarov 2015-10-09 16:48:01 +03:00
parent 456b6b34de
commit 632db51501

View File

@ -68,10 +68,8 @@ class LogoutView(APIView):
permission_classes = (AllowAny,) permission_classes = (AllowAny,)
def post(self, request): def post(self, request):
try: if not request.user.is_anonymous():
request.user.auth_token.delete() request.user.auth_token.delete()
except:
pass
logout(request) logout(request)