Skip to content

Commit

Permalink
Merge pull request #360 from edx/dsjen/django-upgrade
Browse files Browse the repository at this point in the history
Update for django 1.11 compatibility.
  • Loading branch information
dsjen committed Jul 6, 2017
2 parents 1dbbeb2 + fbeeb82 commit ef280f7
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 27 deletions.
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Muhammad Shoaib <[email protected]>
Afzal Wali <[email protected]>
Mushtaq Ali <[email protected]>
Christina Roberts <[email protected]>

Dennis Jen <[email protected]>
2 changes: 1 addition & 1 deletion edx_proctoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import

__version__ = '0.18.1'
__version__ = '0.18.2'

default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name
42 changes: 24 additions & 18 deletions edx_proctoring/management/commands/set_attempt_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

from __future__ import absolute_import

from optparse import make_option

from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError

from edx_proctoring.models import ProctoredExamStudentAttemptStatus

Expand All @@ -16,20 +14,28 @@ class Command(BaseCommand):
Django Management command to force a background check of all possible notifications
"""

option_list = BaseCommand.option_list + (
make_option('-e', '--exam',
metavar='EXAM_ID',
dest='exam_id',
help='exam_id to change'),
make_option('-u', '--user',
metavar='USER',
dest='user_id',
help="user_id of user to affect"),
make_option('-t', '--to',
metavar='TO_STATUS',
dest='to_status',
help='the status to set'),
)
def add_arguments(self, parser):
parser.add_argument(
'-e',
'--exam',
metavar='EXAM_ID',
dest='exam_id',
help='exam_id to change',
)
parser.add_argument(
'-u',
'--user',
metavar='USER',
dest='user_id',
help='user_id of user to affect',
)
parser.add_argument(
'-t',
'--to',
metavar='TO_STATUS',
dest='to_status',
help='the status to set',
)

def handle(self, *args, **options):
"""
Expand All @@ -56,7 +62,7 @@ def handle(self, *args, **options):
print msg

if not ProctoredExamStudentAttemptStatus.is_valid_status(to_status):
raise Exception('{to_status} is not a valid attempt status!'.format(to_status=to_status))
raise CommandError('{to_status} is not a valid attempt status!'.format(to_status=to_status))

# get exam, this will throw exception if does not exist, so let it bomb out
get_exam_by_id(exam_id)
Expand Down
7 changes: 3 additions & 4 deletions edx_proctoring/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
from __future__ import absolute_import

from django.conf import settings
from django.conf.urls import patterns, url, include
from django.conf.urls import url, include

from edx_proctoring import views, callbacks

urlpatterns = patterns( # pylint: disable=invalid-name
'',
urlpatterns = [
url(
r'edx_proctoring/v1/proctored_exam/exam$',
views.ProctoredExamView.as_view(),
Expand Down Expand Up @@ -89,4 +88,4 @@
name='edx_proctoring.anonymous.proctoring_review_callback'
),
url(r'^', include('rest_framework.urls', namespace='rest_framework'))
)
]
7 changes: 7 additions & 0 deletions test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,10 @@
DEFAULT_FROM_EMAIL = '[email protected]'
CONTACT_EMAIL = '[email protected]'
TECH_SUPPORT_EMAIL = '[email protected]'

########## TEMPLATE CONFIGURATION
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
}]
########## END TEMPLATE CONFIGURATION
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py27}-django{18}
envlist = {py27}-django{18,111}

[doc8]
max-line-length = 120
Expand All @@ -21,8 +21,7 @@ setenv =
DJANGO_SETTINGS_MODULE = test_settings
deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11,<2.0
-rrequirements/test.txt
commands =
coverage run ./manage.py test {posargs}
Expand Down

0 comments on commit ef280f7

Please sign in to comment.