From ec39c9289bb12dc4555778cac013b1cea4f5ddac Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 26 Nov 2018 13:08:59 -0500 Subject: [PATCH 01/10] django 1.11.16 --- canvas_manage_course/requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index 976e047..edb0ded 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -1,5 +1,5 @@ boto3==1.4.4 -Django==1.11.9 +Django==1.11.16 cx-Oracle==6.1 django-cached-authentication-middleware==0.2.1 django-redis-cache==1.7.1 From abd44c467d2a865dd880a48cec64f31cad316935 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 10 Dec 2018 12:38:43 -0500 Subject: [PATCH 02/10] Try hard coding lti_launch url --- canvas_manage_course/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index b03fbb1..f0e329c 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -5,7 +5,6 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import redirect, render -from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from ims_lti_py.tool_config import ToolConfig @@ -21,7 +20,7 @@ @require_http_methods(['GET']) def tool_config(request): - url = "https://{}{}".format(request.get_host(), reverse('lti_launch')) + url = "https://{}{}".format(request.get_host(), '/lti_launch') title = 'Manage Course' lti_tool_config = ToolConfig( From 77c4c5c022640e6b36c59cec6230c0110930edce Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 10 Dec 2018 14:26:34 -0500 Subject: [PATCH 03/10] Log url of reverse --- canvas_manage_course/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index f0e329c..fe78440 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import redirect, render +from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from ims_lti_py.tool_config import ToolConfig @@ -20,7 +21,9 @@ @require_http_methods(['GET']) def tool_config(request): - url = "https://{}{}".format(request.get_host(), '/lti_launch') + url = "https://{}{}".format(request.get_host(), reverse('lti_launch')) + + logger.info(url) title = 'Manage Course' lti_tool_config = ToolConfig( From 990c208fd45bb25ddf67380948697a83b0f24fb8 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Tue, 11 Dec 2018 11:05:55 -0500 Subject: [PATCH 04/10] Call out patched reverse and optimized imports --- canvas_manage_course/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index fe78440..850668b 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -5,23 +5,23 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import redirect, render -from django.urls import reverse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from ims_lti_py.tool_config import ToolConfig - -from isites_migration.utils import get_previous_isites from lti_school_permissions.decorators import ( lti_permission_required, lti_permission_required_check) +from django_auth_lti import patch_reverse +from isites_migration.utils import get_previous_isites + logger = logging.getLogger(__name__) @require_http_methods(['GET']) def tool_config(request): - url = "https://{}{}".format(request.get_host(), reverse('lti_launch')) + url = "https://{}{}".format(request.get_host(), patch_reverse.reverse('lti_launch', exclude_resource_link_id=True)) logger.info(url) From bc7689325771d6c679c1209e90db0a93ab9cf253 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Tue, 11 Dec 2018 11:08:22 -0500 Subject: [PATCH 05/10] Slight tweak to import --- canvas_manage_course/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 850668b..c5881d3 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -12,7 +12,7 @@ lti_permission_required, lti_permission_required_check) -from django_auth_lti import patch_reverse +from django_auth_lti.patch_reverse import reverse from isites_migration.utils import get_previous_isites logger = logging.getLogger(__name__) @@ -21,7 +21,7 @@ @require_http_methods(['GET']) def tool_config(request): - url = "https://{}{}".format(request.get_host(), patch_reverse.reverse('lti_launch', exclude_resource_link_id=True)) + url = "https://{}{}".format(request.get_host(), reverse('lti_launch', exclude_resource_link_id=True)) logger.info(url) From 0a0f29fe474dc9c7f7572fc1a169a9640bfa9846 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Tue, 11 Dec 2018 11:19:05 -0500 Subject: [PATCH 06/10] Removed testing log statement --- canvas_manage_course/views.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index c5881d3..1edbf13 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -23,8 +23,6 @@ def tool_config(request): url = "https://{}{}".format(request.get_host(), reverse('lti_launch', exclude_resource_link_id=True)) - logger.info(url) - title = 'Manage Course' lti_tool_config = ToolConfig( title=title, From 1f53e4a46bc6e3c30b292d98edeecaac0f4e106a Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Wed, 12 Dec 2018 11:30:04 -0500 Subject: [PATCH 07/10] Changed the import in views to use url resolvers reverse --- canvas_manage_course/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 1edbf13..141aada 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -5,16 +5,16 @@ from django.contrib.auth.decorators import login_required from django.http import HttpResponse from django.shortcuts import redirect, render +from django.core.urlresolvers import reverse from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_http_methods from ims_lti_py.tool_config import ToolConfig + +from isites_migration.utils import get_previous_isites from lti_school_permissions.decorators import ( lti_permission_required, lti_permission_required_check) -from django_auth_lti.patch_reverse import reverse -from isites_migration.utils import get_previous_isites - logger = logging.getLogger(__name__) From 2625460e49d46f7ccda2d5f8a5c47ca570f7180d Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Wed, 12 Dec 2018 11:31:59 -0500 Subject: [PATCH 08/10] Bumped cached-auth-middleware and django-auth-lti versions --- canvas_manage_course/requirements/base.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index edb0ded..bbbb1e7 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -1,7 +1,7 @@ boto3==1.4.4 Django==1.11.16 cx-Oracle==6.1 -django-cached-authentication-middleware==0.2.1 +django-cached-authentication-middleware==0.2.2 django-redis-cache==1.7.1 hiredis==0.2.0 kitchen==1.2.4 @@ -10,7 +10,7 @@ psycopg2==2.7.3.2 requests==2.13.0 git+ssh://git@github.com/penzance/canvas_python_sdk.git@v0.10.2#egg=canvas-python-sdk==0.10.2 -git+ssh://git@github.com/Harvard-University-iCommons/django-auth-lti.git@v1.2.9#egg=django-auth-lti==1.2.9 +git+ssh://git@github.com/Harvard-University-iCommons/django-auth-lti.git@v1.3.0#egg=django-auth-lti==1.3.0 git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.37.1#egg=django-icommons-common[async]==v1.37.1 git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.3#egg=django-icommons-ui==1.5.3 From 6a7ca60e6dcfdc799bc9b72bf025b311a482c646 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Wed, 12 Dec 2018 11:34:06 -0500 Subject: [PATCH 09/10] Base and local requirements files now use formatting for newer version of Django --- canvas_manage_course/settings/base.py | 14 ++++++++------ canvas_manage_course/settings/local.py | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/canvas_manage_course/settings/base.py b/canvas_manage_course/settings/base.py index 7ff974e..253f9aa 100644 --- a/canvas_manage_course/settings/base.py +++ b/canvas_manage_course/settings/base.py @@ -15,6 +15,8 @@ import os import warnings +# Need to import patch_reverse here to override the loading order of Django's reverse function. +from django_auth_lti import patch_reverse from django.core.urlresolvers import reverse_lazy from .secure import SECURE_SETTINGS @@ -29,7 +31,7 @@ # Application definition -INSTALLED_APPS = ( +INSTALLED_APPS = [ 'async', 'canvas_manage_course', 'class_roster', @@ -48,20 +50,20 @@ 'lti_school_permissions', 'manage_people', 'manage_sections', -) +] -MIDDLEWARE_CLASSES = ( +MIDDLEWARE_CLASSES = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'cached_auth.Middleware', 'django_auth_lti.middleware_patched.MultiLTILaunchAuthMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.security.SecurityMiddleware', -) +] -AUTHENTICATION_BACKENDS = ( +AUTHENTICATION_BACKENDS = [ 'django_auth_lti.backends.LTIAuthBackend', -) +] LOGIN_URL = reverse_lazy('lti_auth_error') diff --git a/canvas_manage_course/settings/local.py b/canvas_manage_course/settings/local.py index 5e686b7..065821b 100644 --- a/canvas_manage_course/settings/local.py +++ b/canvas_manage_course/settings/local.py @@ -5,8 +5,8 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' -INSTALLED_APPS += ('debug_toolbar', 'sslserver') -MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) +INSTALLED_APPS += ['debug_toolbar', 'sslserver'] +MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware'] # For Django Debug Toolbar: INTERNAL_IPS = ('127.0.0.1', '10.0.2.2',) From 74f2726310fa21ec4d343d4fa81225b3e7aab243 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Thu, 13 Dec 2018 13:14:29 -0500 Subject: [PATCH 10/10] Changed MIDDLEWARE_CLASSES to MIDDLEWARE in base.py --- canvas_manage_course/settings/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canvas_manage_course/settings/base.py b/canvas_manage_course/settings/base.py index 253f9aa..26f2e39 100644 --- a/canvas_manage_course/settings/base.py +++ b/canvas_manage_course/settings/base.py @@ -52,7 +52,7 @@ 'manage_sections', ] -MIDDLEWARE_CLASSES = [ +MIDDLEWARE = [ 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'cached_auth.Middleware',