def get_user(self, user_id): """Return the user associated with the user_id specified. """ _assert_properly_configured() if isinstance(user_id, int): local_user = User.objects.get(id=user_id) remote_user = \ client.auth.django.contrib.auth.User.get( **{'username':local_user.username}) else: remote_user = \ client.auth.django.contrib.auth.User.get( **{'username':user_id}) return attach_to_local_user(remote_user)
def get_user(self, user_id): """Return the user associated with the user_id specified. """ _assert_properly_configured() try: try: local_user = User.objects.get(**{'username':user_id}) remote_user =\ client.auth.django.contrib.auth.User.get( username=local_user.username) except User.DoesNotExist: remote_user =\ client.auth.django.contrib.auth.User.get(**{'username':user_id}) except AssertionError: return None return attach_to_local_user(remote_user)
def get_user(self, user_id): """Return the user associated with the user_id specified. """ _assert_properly_configured() if isinstance(user_id, int): # The get method is added by Django in some odd way # pylint: disable=no-member local_user = User.objects.get(id=user_id) remote_user = \ client.auth.django.contrib.auth.User.get( **{'username':local_user.username}) else: remote_user = \ client.auth.django.contrib.auth.User.get( **{'username':user_id}) return attach_to_local_user(remote_user)