From 70d06beec7db3f35488fec6c18b2bee87317d746 Mon Sep 17 00:00:00 2001 From: Sapna Mysore Date: Thu, 1 Feb 2018 13:26:15 -0500 Subject: [PATCH 1/9] Upgrading Django and other libraries --- canvas_manage_course/requirements/base.txt | 20 +++++++++++--------- canvas_manage_course/requirements/local.txt | 2 +- canvas_manage_course/urls.py | 7 +++++++ canvas_manage_course/views.py | 13 ++++++++++--- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index b70fc00..10e01b0 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -1,17 +1,19 @@ boto3==1.4.4 -Django==1.9.12 -cx-Oracle==5.2.1 +Django==1.11.9 +cx-Oracle==6.0.3 django-cached-authentication-middleware==0.2.1 django-redis-cache==1.7.1 hiredis==0.2.0 kitchen==1.2.4 ndg-httpsclient==0.4.2 -redis==2.10.5 -psycopg2==2.6.2 +redis==2.10.6 +psycopg2==2.7.3.2 requests==2.13.0 -git+ssh://git@github.com/penzance/canvas_python_sdk.git@v0.8.4#egg=canvas-python-sdk==0.8.4 -git+ssh://git@github.com/Harvard-University-iCommons/django-auth-lti.git@v1.2.5#egg=django-auth-lti==1.2.5 -git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.18.2#egg=django-icommons-common[async]==1.18.2 -git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.3.1#egg=django-icommons-ui==1.3.1 -git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.5.2#egg=django-canvas-lti-school-permissions==0.5.2 +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-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 +-e ../django-icommons-common +git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.2#egg=django-icommons-ui==1.5.2 +#git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.5.2#egg=django-canvas-lti-school-permissions==0.5.2 +-e ../lti-school-permissions \ No newline at end of file diff --git a/canvas_manage_course/requirements/local.txt b/canvas_manage_course/requirements/local.txt index 56841cc..c5bc3f0 100644 --- a/canvas_manage_course/requirements/local.txt +++ b/canvas_manage_course/requirements/local.txt @@ -5,7 +5,7 @@ # below are requirements specific to the local environment ddt==1.1.1 -django-debug-toolbar==1.5 +django-debug-toolbar==1.8 django-sslserver==0.19 mock==2.0.0 oauthlib==1.1.1 diff --git a/canvas_manage_course/urls.py b/canvas_manage_course/urls.py index 83bdf96..5cbaa57 100644 --- a/canvas_manage_course/urls.py +++ b/canvas_manage_course/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import include, url +from django.conf import settings from canvas_manage_course import views from icommons_ui import views as icommons_ui_views @@ -15,3 +16,9 @@ url(r'^not_authorized$', icommons_ui_views.not_authorized, name='not_authorized'), url(r'^tool_config$', views.tool_config, name='tool_config'), ] + +if settings.DEBUG: + import debug_toolbar + urlpatterns += [ + url(r'^__debug__/', include(debug_toolbar.urls)), + ] diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 604ec35..18bb7ca 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -3,7 +3,8 @@ import logging from django.contrib.auth.decorators import login_required -from django.core.urlresolvers import reverse +from django.urls import reverse + from django.http import HttpResponse from django.shortcuts import redirect, render from django.views.decorators.csrf import csrf_exempt @@ -21,8 +22,14 @@ @require_http_methods(['GET']) def tool_config(request): - url = "%s://%s%s" % (request.scheme, request.get_host(), - reverse('lti_launch', exclude_resource_link_id=True)) + + if request.is_secure(): + host = 'https://' + request.get_host() + else: + host = 'http://' + request.get_host() + + url = host + reverse('lti_launch')+'?exclude_resource_link_id=True' + title = 'Manage Course' lti_tool_config = ToolConfig( title=title, From 945cbaaee243dae854ce2a09f5a9ba22601f417e Mon Sep 17 00:00:00 2001 From: Sapna Mysore Date: Mon, 5 Feb 2018 11:10:22 -0500 Subject: [PATCH 2/9] Handled the issue with importing the fix for Django>=1.10 for django-pgjson library . --- canvas_manage_course/requirements/base.txt | 11 +++++++---- canvas_manage_course/views.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index 10e01b0..52c7274 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -12,8 +12,11 @@ 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-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 --e ../django-icommons-common + +# NOTE: Including the django-pgjson library here. This is required by 'async' within django-icommons-common, but +# there is fix for a bug for django<=1.10 , thgat is still in a commit but is not in the released version. Unable to specify +# a commit in the django-icommons-common's setup.py, hence including it in the consuming app till we used switch from pjson to standard json +git+ssh://git@github.com/djangonauts/django-pgjson.git@30463d210a42b2de#egg=django-pgjson +git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.2#egg=django-icommons-ui==1.5.2 -#git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.5.2#egg=django-canvas-lti-school-permissions==0.5.2 --e ../lti-school-permissions \ No newline at end of file +git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.6#egg=django-canvas-lti-school-permissions==0.6 diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 18bb7ca..89d21f7 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -28,7 +28,7 @@ def tool_config(request): else: host = 'http://' + request.get_host() - url = host + reverse('lti_launch')+'?exclude_resource_link_id=True' + url = host + reverse('lti_launch') title = 'Manage Course' lti_tool_config = ToolConfig( From 045d12b79939df1dfbde132c601ef1eef1edf57e Mon Sep 17 00:00:00 2001 From: Sapna Mysore Date: Wed, 7 Feb 2018 17:18:13 -0500 Subject: [PATCH 3/9] Changes per PR feedback --- canvas_manage_course/requirements/base.txt | 5 ++--- canvas_manage_course/urls.py | 14 +++++++++----- canvas_manage_course/views.py | 10 ++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index 52c7274..1c49243 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -1,11 +1,10 @@ boto3==1.4.4 Django==1.11.9 -cx-Oracle==6.0.3 +cx-Oracle==6.1 django-cached-authentication-middleware==0.2.1 django-redis-cache==1.7.1 hiredis==0.2.0 kitchen==1.2.4 -ndg-httpsclient==0.4.2 redis==2.10.6 psycopg2==2.7.3.2 requests==2.13.0 @@ -14,7 +13,7 @@ git+ssh://git@github.com/penzance/canvas_python_sdk.git@v0.10.2#egg=canvas-pytho git+ssh://git@github.com/Harvard-University-iCommons/django-auth-lti.git@v1.2.9#egg=django-auth-lti==1.2.9 # NOTE: Including the django-pgjson library here. This is required by 'async' within django-icommons-common, but -# there is fix for a bug for django<=1.10 , thgat is still in a commit but is not in the released version. Unable to specify +# there is fix for a bug for django>=1.10 , that is still in a commit but is not in the released version. Unable to specify # a commit in the django-icommons-common's setup.py, hence including it in the consuming app till we used switch from pjson to standard json git+ssh://git@github.com/djangonauts/django-pgjson.git@30463d210a42b2de#egg=django-pgjson git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 diff --git a/canvas_manage_course/urls.py b/canvas_manage_course/urls.py index 5cbaa57..713885d 100644 --- a/canvas_manage_course/urls.py +++ b/canvas_manage_course/urls.py @@ -17,8 +17,12 @@ url(r'^tool_config$', views.tool_config, name='tool_config'), ] -if settings.DEBUG: - import debug_toolbar - urlpatterns += [ - url(r'^__debug__/', include(debug_toolbar.urls)), - ] +try: + if settings.DEBUG: + import debug_toolbar + urlpatterns += [ + url(r'^__debug__/', include(debug_toolbar.urls)), + ] +except: + pass + diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 89d21f7..22feafe 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -3,13 +3,11 @@ import logging from django.contrib.auth.decorators import login_required -from django.urls import reverse - 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 @@ -23,11 +21,7 @@ @require_http_methods(['GET']) def tool_config(request): - if request.is_secure(): - host = 'https://' + request.get_host() - else: - host = 'http://' + request.get_host() - + host = 'https://' + request.get_host() url = host + reverse('lti_launch') title = 'Manage Course' From 2f81f399e60eb9ec02e98a2c88361efb95cfd86f Mon Sep 17 00:00:00 2001 From: Sapna Mysore Date: Fri, 16 Feb 2018 11:42:31 -0500 Subject: [PATCH 4/9] Testing switching to new JSON field --- canvas_manage_course/requirements/base.txt | 5 +++-- canvas_manage_course/settings/base.py | 1 + isites_migration/views.py | 10 +++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index 1c49243..d08b411 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -16,6 +16,7 @@ git+ssh://git@github.com/Harvard-University-iCommons/django-auth-lti.git@v1.2.9# # there is fix for a bug for django>=1.10 , that is still in a commit but is not in the released version. Unable to specify # a commit in the django-icommons-common's setup.py, hence including it in the consuming app till we used switch from pjson to standard json git+ssh://git@github.com/djangonauts/django-pgjson.git@30463d210a42b2de#egg=django-pgjson -git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 +#git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 +-e ../django-icommons-common git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.2#egg=django-icommons-ui==1.5.2 -git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.6#egg=django-canvas-lti-school-permissions==0.6 +git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.6#egg=django-canvas-lti-school-permissions==0.6 \ No newline at end of file diff --git a/canvas_manage_course/settings/base.py b/canvas_manage_course/settings/base.py index 55a15f4..7ff974e 100644 --- a/canvas_manage_course/settings/base.py +++ b/canvas_manage_course/settings/base.py @@ -37,6 +37,7 @@ 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', + 'django.contrib.postgres', 'django.contrib.staticfiles', 'django_auth_lti', 'django_rq', diff --git a/isites_migration/views.py b/isites_migration/views.py index b2eb6e4..d3ef5af 100644 --- a/isites_migration/views.py +++ b/isites_migration/views.py @@ -44,12 +44,20 @@ def index(request): course_instance_id, canvas_course_id, school)) return redirect('isites_migration:index') + print(" here1") + # processes = Process.objects.filter( + # name='isites_migration.jobs.migrate_files', + # details__at_canvas_course_id=canvas_course_id + # ).order_by('-date_created') processes = Process.objects.filter( name='isites_migration.jobs.migrate_files', - details__at_canvas_course_id=canvas_course_id + details__canvas_course_id=canvas_course_id ).order_by('-date_created') + print(" here2", processes) + has_active_process = len([p for p in processes if p.state != Process.COMPLETE]) > 0 + print(" here3, ",has_active_process) return render(request, 'isites_migration/index.html', { 'isites': get_previous_isites(course_instance_id), 'processes': processes, From 521bdc4a41f0428193eadd06a24ccb73e56da458 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Wed, 28 Feb 2018 14:14:50 -0500 Subject: [PATCH 5/9] Removed pgjson requirement from base and pointed icommons-common to branch --- canvas_manage_course/requirements/base.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index d08b411..ffb8d07 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -12,11 +12,6 @@ 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 -# NOTE: Including the django-pgjson library here. This is required by 'async' within django-icommons-common, but -# there is fix for a bug for django>=1.10 , that is still in a commit but is not in the released version. Unable to specify -# a commit in the django-icommons-common's setup.py, hence including it in the consuming app till we used switch from pjson to standard json -git+ssh://git@github.com/djangonauts/django-pgjson.git@30463d210a42b2de#egg=django-pgjson -#git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.33.1#egg=django-icommons-common[async]==1.33.1 --e ../django-icommons-common +git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@task/sapnamysore/tlt-3253/upgrade-django#egg=django-icommons-common[async]==task/sapnamysore/tlt-3253/upgrade-django git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.2#egg=django-icommons-ui==1.5.2 git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.6#egg=django-canvas-lti-school-permissions==0.6 \ No newline at end of file From 8836bd8cfaa1c8f5644b72cac5b845b201f0e841 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 5 Mar 2018 11:29:41 -0500 Subject: [PATCH 6/9] Context instance is deprecated 1.10+ --- isites_migration/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/isites_migration/utils.py b/isites_migration/utils.py index abd17af..2de656f 100644 --- a/isites_migration/utils.py +++ b/isites_migration/utils.py @@ -13,7 +13,6 @@ from django.conf import settings from django.db.models import Q from django.template.loader import get_template -from django.template import Context from django.db import connections from django.utils.text import get_valid_filename from canvas_sdk.methods import content_migrations, files @@ -365,7 +364,7 @@ def _export_topic_text(topic_text, topic_title, keyword, zip_file): def _export_readme(keyword, zip_file, readme_filename): logger.debug("Exporting readme file for keyword %s", keyword) readme_template = get_template('isites_migration/export_files_readme.html') - content = readme_template.render(Context({})) + content = readme_template.render({}) zip_file.writestr(os.path.join(keyword, readme_filename), content) logging.debug("Copied Readme file to export location %s", readme_filename) From 0c581212ce44883b24718b74afbb749f97078fa1 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 5 Mar 2018 15:16:43 -0500 Subject: [PATCH 7/9] Code cleanup --- canvas_manage_course/requirements/base.txt | 2 +- isites_migration/views.py | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/canvas_manage_course/requirements/base.txt b/canvas_manage_course/requirements/base.txt index ffb8d07..86db461 100644 --- a/canvas_manage_course/requirements/base.txt +++ b/canvas_manage_course/requirements/base.txt @@ -12,6 +12,6 @@ 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-icommons-common.git@task/sapnamysore/tlt-3253/upgrade-django#egg=django-icommons-common[async]==task/sapnamysore/tlt-3253/upgrade-django +git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-common.git@v1.34#egg=django-icommons-common[async]==v1.34 git+ssh://git@github.com/Harvard-University-iCommons/django-icommons-ui.git@v1.5.2#egg=django-icommons-ui==1.5.2 git+ssh://git@github.com/Harvard-University-iCommons/django-canvas-lti-school-permissions@v0.6#egg=django-canvas-lti-school-permissions==0.6 \ No newline at end of file diff --git a/isites_migration/views.py b/isites_migration/views.py index d3ef5af..d7250a1 100644 --- a/isites_migration/views.py +++ b/isites_migration/views.py @@ -44,20 +44,12 @@ def index(request): course_instance_id, canvas_course_id, school)) return redirect('isites_migration:index') - print(" here1") - # processes = Process.objects.filter( - # name='isites_migration.jobs.migrate_files', - # details__at_canvas_course_id=canvas_course_id - # ).order_by('-date_created') processes = Process.objects.filter( name='isites_migration.jobs.migrate_files', details__canvas_course_id=canvas_course_id ).order_by('-date_created') - print(" here2", processes) - has_active_process = len([p for p in processes if p.state != Process.COMPLETE]) > 0 - print(" here3, ",has_active_process) return render(request, 'isites_migration/index.html', { 'isites': get_previous_isites(course_instance_id), 'processes': processes, From 96d3d81e9488cec76875dba1271e1bd155e0b192 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Mon, 5 Mar 2018 15:17:07 -0500 Subject: [PATCH 8/9] Updated migration to use boolean values --- .../0002_mp_school_allowed_roles.py | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/manage_people/migrations/0002_mp_school_allowed_roles.py b/manage_people/migrations/0002_mp_school_allowed_roles.py index a25d616..af12371 100644 --- a/manage_people/migrations/0002_mp_school_allowed_roles.py +++ b/manage_people/migrations/0002_mp_school_allowed_roles.py @@ -4,69 +4,69 @@ from django.db import migrations, models,transaction SCHOOL_ALOWED_ROLE_DATA = [ - ('gse', 9, 'N'), - ('gse', 10, 'Y'), - ('gse', 11, 'N'), - ('gse', 12, 'N'), - ('gse', 15, 'Y'), - ('colgsas', 9, 'N'), - ('colgsas', 5, 'N'), - ('colgsas', 7, 'N'), - ('colgsas', 10, 'Y'), - ('colgsas', 11, 'N'), - ('gsd', 5, 'N'), - ('gsd', 11, 'N'), - ('gsd', 12, 'N'), - ('gsd', 10, 'Y'), - ('hds', 9, 'N'), - ('hds', 5, 'N'), - ('hds', 7, 'N'), - ('hds', 10, 'Y'), - ('hds', 11, 'N'), - ('hds', 12, 'N'), - ('ext', 9, 'N'), - ('ext', 5, 'N'), - ('ext', 7, 'N'), - ('ext', 10, 'Y'), - ('ext', 11, 'N'), - ('sum', 9, 'N'), - ('sum', 5, 'N'), - ('sum', 7, 'N'), - ('sum', 10, 'Y'), - ('sum', 11, 'N'), - ('hks', 5, 'N'), - ('hks', 10, 'Y'), - ('hls', 5, 'N'), - ('hls', 7, 'N'), - ('hls', 10, 'Y'), - ('hls', 11, 'N'), - ('hls', 12, 'N'), - ('hlsexeced', 5, 'N'), - ('hlsexeced', 7, 'N'), - ('hlsexeced', 9, 'N'), - ('hlsexeced', 10, 'Y'), - ('hlsexeced', 11, 'N'), - ('hlsexeced', 12, 'N'), - ('hlsexeced', 0, 'N'), - ('hms', 9, 'N'), - ('hms', 5, 'N'), - ('hms', 7, 'N'), - ('hms', 10, 'Y'), - ('hsdm', 9, 'N'), - ('hsdm', 5, 'N'), - ('hsdm', 7, 'N'), - ('hsdm', 10, 'Y'), - ('hsph', 9, 'N'), - ('hsph', 5, 'N'), - ('hsph', 7, 'N'), - ('hsph', 10, 'Y'), - ('hsph', 11, 'Y'), - ('hsph', 12, 'Y'), - ('hsph', 15, 'Y'), - ('hilr', 9, 'N'), - ('hilr', 5, 'N'), - ('hilr', 7, 'N'), - ('hilr', 10, 'Y') + ('gse', 9, False), + ('gse', 10, True), + ('gse', 11, False), + ('gse', 12, False), + ('gse', 15, True), + ('colgsas', 9, False), + ('colgsas', 5, False), + ('colgsas', 7, False), + ('colgsas', 10, True), + ('colgsas', 11, False), + ('gsd', 5, False), + ('gsd', 11, False), + ('gsd', 12, False), + ('gsd', 10, True), + ('hds', 9, False), + ('hds', 5, False), + ('hds', 7, False), + ('hds', 10, True), + ('hds', 11, False), + ('hds', 12, False), + ('ext', 9, False), + ('ext', 5, False), + ('ext', 7, False), + ('ext', 10, True), + ('ext', 11, False), + ('sum', 9, False), + ('sum', 5, False), + ('sum', 7, False), + ('sum', 10, True), + ('sum', 11, False), + ('hks', 5, False), + ('hks', 10, True), + ('hls', 5, False), + ('hls', 7, False), + ('hls', 10, True), + ('hls', 11, False), + ('hls', 12, False), + ('hlsexeced', 5, False), + ('hlsexeced', 7, False), + ('hlsexeced', 9, False), + ('hlsexeced', 10, True), + ('hlsexeced', 11, False), + ('hlsexeced', 12, False), + ('hlsexeced', 0, False), + ('hms', 9, False), + ('hms', 5, False), + ('hms', 7, False), + ('hms', 10, True), + ('hsdm', 9, False), + ('hsdm', 5, False), + ('hsdm', 7, False), + ('hsdm', 10, True), + ('hsph', 9, False), + ('hsph', 5, False), + ('hsph', 7, False), + ('hsph', 10, True), + ('hsph', 11, True), + ('hsph', 12, True), + ('hsph', 15, True), + ('hilr', 9, False), + ('hilr', 5, False), + ('hilr', 7, False), + ('hilr', 10, True) ] def populate_school_allowed_role(apps, schema_editor): From 41c28a8b9db69ac544a46be055fecdbec080c543 Mon Sep 17 00:00:00 2001 From: Chris-Thornton-Harvard Date: Thu, 8 Mar 2018 10:05:06 -0500 Subject: [PATCH 9/9] PR touchups --- canvas_manage_course/urls.py | 11 +++++++---- canvas_manage_course/views.py | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/canvas_manage_course/urls.py b/canvas_manage_course/urls.py index 713885d..074ddaf 100644 --- a/canvas_manage_course/urls.py +++ b/canvas_manage_course/urls.py @@ -17,12 +17,15 @@ url(r'^tool_config$', views.tool_config, name='tool_config'), ] -try: - if settings.DEBUG: +# Import the debug toolbar and handle any namespace issues that may occur +# ie: 'djdt' is not a registered namespace +# https://github.com/jazzband/django-debug-toolbar/issues/529 +if settings.DEBUG: + try: import debug_toolbar urlpatterns += [ url(r'^__debug__/', include(debug_toolbar.urls)), ] -except: - pass + except: + pass diff --git a/canvas_manage_course/views.py b/canvas_manage_course/views.py index 22feafe..a223a8a 100644 --- a/canvas_manage_course/views.py +++ b/canvas_manage_course/views.py @@ -21,8 +21,7 @@ @require_http_methods(['GET']) def tool_config(request): - host = 'https://' + request.get_host() - url = host + reverse('lti_launch') + url = "https://{}{}".format(request.get_host(), reverse('lti_launch')) title = 'Manage Course' lti_tool_config = ToolConfig(