# HG changeset patch # User ymh # Date 1469454812 -7200 # Node ID f3fa1e9d0b241fb7f6e344910cad16792aadb762 # Parent c895dbf60086d52455afa9a5be9124faabc6b566 Correct recursion loop in authentication diff -r c895dbf60086 -r f3fa1e9d0b24 server/src/metaeducation/auth.py --- a/server/src/metaeducation/auth.py Mon Jul 25 14:15:12 2016 +0200 +++ b/server/src/metaeducation/auth.py Mon Jul 25 15:53:32 2016 +0200 @@ -91,7 +91,7 @@ logger.debug("CLIENT CREDENTIAL AUTH: user %r is authenticated by token %r, auth success", external_id, token) - if hasattr(request, 'renkan_request_id') and user != getattr(request,'user', None): + if hasattr(request, 'renkan_request_id'): # ideally should check if new user is different, but that cause a recursion loop in rest famework (c.f. : rest_framework/request.py", line 193, in user : self._authenticate())) - user != getattr(request,'user', None): # Re-register the tracking handlers with the new user logger.debug("CLIENT CREDENTIAL AUTH: Change the registered tracking handlers to user %r", user.external_id) change_handlers_user(user, request.renkan_request_id)