diff --git a/lms/djangoapps/discussion_api/tests/test_views.py b/lms/djangoapps/discussion_api/tests/test_views.py index 6a50baaa08..c5ee2eeb59 100644 --- a/lms/djangoapps/discussion_api/tests/test_views.py +++ b/lms/djangoapps/discussion_api/tests/test_views.py @@ -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 diff --git a/lms/djangoapps/discussion_api/views.py b/lms/djangoapps/discussion_api/views.py index 7af8820071..316c0e22b5 100644 --- a/lms/djangoapps/discussion_api/views.py +++ b/lms/djangoapps/discussion_api/views.py @@ -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) diff --git a/openedx/core/djangoapps/user_api/accounts/views.py b/openedx/core/djangoapps/user_api/accounts/views.py index 8f243ac863..94913343eb 100644 --- a/openedx/core/djangoapps/user_api/accounts/views.py +++ b/openedx/core/djangoapps/user_api/accounts/views.py @@ -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,