qiality
This commit is contained in:
@@ -10,7 +10,6 @@ from urlparse import urlparse
|
||||
import ddt
|
||||
import httpretty
|
||||
import mock
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from edx_oauth2_provider.tests.factories import ClientFactory, AccessTokenFactory
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
@@ -627,7 +627,7 @@ class ReplaceUsernameView(APIView):
|
||||
if exc.status_code == 404:
|
||||
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||
raise
|
||||
except Exception as exc:
|
||||
except Exception as exc: #pylint disable-broad-except
|
||||
return Response(text_type(exc), status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
@@ -1118,7 +1118,6 @@ class UsernameReplacementView(APIView):
|
||||
|
||||
def _generate_unique_username(self, desired_username, suffix_length=4):
|
||||
""" Accepts a username and returns a unique username if the requested is taken """
|
||||
User = apps.get_model('auth.user')
|
||||
new_username = desired_username
|
||||
# Keep checking usernames in case desired_username + random suffix is already taken
|
||||
while True:
|
||||
@@ -1145,7 +1144,7 @@ class UsernameReplacementView(APIView):
|
||||
).update(
|
||||
**{column: new_username}
|
||||
)
|
||||
except Exception as exc:
|
||||
except Exception as exc: #pylint: disable-broad-except
|
||||
log.exception("Unable to change username from {current} to {new}. Reason: {error}".format(
|
||||
current=current_username,
|
||||
new=new_username,
|
||||
|
||||
Reference in New Issue
Block a user