From e18448e27d07ec63b6099f3bc8aa214a982c6105 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 2 May 2018 10:03:50 -0400 Subject: [PATCH] Silence deprecation warnings https://docs.djangoproject.com/en/1.11/releases/1.10/#using-user-is-authenticated-and-user-is-anonymous-as-methods --- cms/djangoapps/contentstore/api/views.py | 2 +- cms/djangoapps/contentstore/views/public.py | 4 ++-- cms/templates/base.html | 4 ++-- cms/templates/widgets/header.html | 4 ++-- cms/templates/widgets/segment-io-footer.html | 2 +- common/djangoapps/django_comment_common/models.py | 2 +- common/djangoapps/enrollment/views.py | 2 +- common/djangoapps/student/auth.py | 2 +- common/djangoapps/student/roles.py | 10 +++++----- common/djangoapps/student/views/login.py | 2 +- common/djangoapps/student/views/management.py | 8 ++++---- common/djangoapps/third_party_auth/pipeline.py | 2 +- common/djangoapps/util/cache.py | 2 +- common/djangoapps/util/milestones_helpers.py | 2 +- common/djangoapps/util/views.py | 8 ++++---- common/djangoapps/xblock_django/user_service.py | 2 +- .../test_site/templates/static_templates/faq.html | 2 +- lms/djangoapps/branding/views.py | 2 +- lms/djangoapps/certificates/views/xqueue.py | 2 +- lms/djangoapps/commerce/api/v1/permissions.py | 4 ++-- lms/djangoapps/commerce/api/v1/views.py | 2 +- lms/djangoapps/commerce/utils.py | 2 +- lms/djangoapps/course_goals/api.py | 2 +- lms/djangoapps/course_wiki/middleware.py | 2 +- lms/djangoapps/courseware/access.py | 8 ++++---- lms/djangoapps/courseware/context_processor.py | 2 +- lms/djangoapps/courseware/entrance_exams.py | 4 ++-- lms/djangoapps/courseware/middleware.py | 2 +- lms/djangoapps/courseware/model_data.py | 12 ++++++------ lms/djangoapps/courseware/module_render.py | 8 ++++---- lms/djangoapps/courseware/tabs.py | 4 ++-- lms/djangoapps/courseware/user_state_client.py | 2 +- lms/djangoapps/courseware/views/index.py | 12 ++++++------ lms/djangoapps/courseware/views/views.py | 14 +++++++------- lms/djangoapps/django_comment_client/base/views.py | 2 +- lms/djangoapps/edxnotes/plugins.py | 2 +- lms/djangoapps/experiments/utils.py | 2 +- lms/djangoapps/grades/api/views.py | 2 +- lms/djangoapps/learner_dashboard/programs.py | 4 ++-- lms/djangoapps/lti_provider/tests/test_users.py | 4 ++-- lms/djangoapps/lti_provider/users.py | 2 +- lms/djangoapps/notification_prefs/views.py | 6 +++--- lms/djangoapps/shoppingcart/context_processor.py | 2 +- lms/djangoapps/shoppingcart/models.py | 2 +- lms/djangoapps/shoppingcart/views.py | 2 +- lms/djangoapps/student_account/views.py | 6 +++--- lms/djangoapps/support/views/contact_us.py | 2 +- lms/djangoapps/survey/models.py | 2 +- lms/djangoapps/survey/utils.py | 2 +- lms/templates/certificates/valid.html | 2 +- lms/templates/courseware/course_about.html | 4 ++-- lms/templates/courseware/courseware.html | 2 +- lms/templates/courseware/info.html | 2 +- lms/templates/courseware/syllabus.html | 2 +- lms/templates/discussion/_discussion_inline.html | 4 ++-- lms/templates/header/header.html | 4 ++-- lms/templates/help_modal.html | 4 ++-- lms/templates/navigation/navigation.html | 6 +++--- lms/templates/support/contact_us.html | 2 +- lms/templates/widgets/segment-io-footer.html | 2 +- openedx/core/djangoapps/bookmarks/api.py | 2 +- .../core/djangoapps/cache_toolbox/middleware.py | 2 +- .../core/djangoapps/contentserver/middleware.py | 2 +- openedx/core/djangoapps/dark_lang/middleware.py | 2 +- openedx/core/djangoapps/dark_lang/views.py | 2 +- openedx/core/djangoapps/external_auth/views.py | 4 ++-- openedx/core/djangoapps/lang_pref/middleware.py | 4 ++-- openedx/core/djangoapps/programs/utils.py | 6 +++--- .../session_inactivity_timeout/middleware.py | 2 +- openedx/core/djangoapps/theming/views.py | 4 ++-- openedx/core/djangoapps/user_api/helpers.py | 2 +- openedx/core/djangoapps/user_api/middleware.py | 2 +- .../core/djangoapps/util/tests/test_user_utils.py | 2 +- openedx/core/lib/api/authentication.py | 2 +- .../xblock_discussion/__init__.py | 2 +- .../course_experience/views/course_dates.py | 2 +- .../course_experience/views/course_home.py | 2 +- openedx/features/enterprise_support/api.py | 8 ++++---- openedx/features/enterprise_support/middleware.py | 2 +- 79 files changed, 137 insertions(+), 137 deletions(-) diff --git a/cms/djangoapps/contentstore/api/views.py b/cms/djangoapps/contentstore/api/views.py index 5761f34d5c..e8d3c49ebb 100644 --- a/cms/djangoapps/contentstore/api/views.py +++ b/cms/djangoapps/contentstore/api/views.py @@ -35,7 +35,7 @@ class CourseImportExportViewMixin(DeveloperErrorViewMixin): Ensures that the user is authenticated (e.g. not an AnonymousUser) """ super(CourseImportExportViewMixin, self).perform_authentication(request) - if request.user.is_anonymous(): + if request.user.is_anonymous: raise AuthenticationFailed diff --git a/cms/djangoapps/contentstore/views/public.py b/cms/djangoapps/contentstore/views/public.py index f054564534..0a7e568ac7 100644 --- a/cms/djangoapps/contentstore/views/public.py +++ b/cms/djangoapps/contentstore/views/public.py @@ -24,7 +24,7 @@ def signup(request): Display the signup form. """ csrf_token = csrf(request)['csrf_token'] - if request.user.is_authenticated(): + if request.user.is_authenticated: return redirect('/course/') if settings.FEATURES.get('AUTH_USE_CERTIFICATES_IMMEDIATE_SIGNUP'): # Redirect to course to login to process their certificate if SSL is enabled @@ -68,7 +68,7 @@ def login_page(request): def howitworks(request): "Proxy view" - if request.user.is_authenticated(): + if request.user.is_authenticated: return redirect('/home/') else: return render_to_response('howitworks.html', {}) diff --git a/cms/templates/base.html b/cms/templates/base.html index 9332d92263..0a6b896f47 100644 --- a/cms/templates/base.html +++ b/cms/templates/base.html @@ -110,7 +110,7 @@ from openedx.core.release import RELEASE_LINE - % if user.is_authenticated(): + % if user.is_authenticated: <%include file="widgets/sock.html" args="online_help_token=online_help_token" /> % endif <%include file="widgets/footer.html" /> @@ -142,7 +142,7 @@ from openedx.core.release import RELEASE_LINE } % endif - % if user.is_authenticated(): + % if user.is_authenticated: <%static:invoke_page_bundle page_name='js/sock'/> % endif <%block name='page_bundle'> diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index ecdabc0658..512078e088 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -190,7 +190,7 @@ % endif % endif - % if user.is_authenticated(): + % if user.is_authenticated: