Files changed by modernize and new gitignore type file.

This commit is contained in:
Squirrel18
2018-06-25 17:27:51 -05:00
parent 48e6ce6336
commit 4f12be0894
8 changed files with 22 additions and 11 deletions

1
.gitignore vendored
View File

@@ -135,6 +135,7 @@ lms/lib/comment_client/python
autodeploy.properties
.ws_migrations_complete
dist
*.bak
# Visual Studio Code
.vscode

View File

@@ -1,6 +1,7 @@
"""
Course Goals Views - includes REST API
"""
from __future__ import absolute_import
import analytics
from django.contrib.auth import get_user_model

View File

@@ -2,6 +2,7 @@
This module creates a sysadmin dashboard for managing and viewing
courses.
"""
from __future__ import absolute_import
import unicodecsv as csv
import json
import logging
@@ -127,7 +128,7 @@ class Users(SysadminDashboardView):
continue
try:
testuser = authenticate(username=euser.username, password=epass)
except (TypeError, PermissionDenied, AttributeError), err:
except (TypeError, PermissionDenied, AttributeError) as err:
# Translators: This message means that the user could not be authenticated (that is, we could
# not log them in for some reason - maybe they don't have permission, or their password was wrong)
msg += _('Failed in authenticating {username}, error {error}\n').format(
@@ -235,13 +236,13 @@ class Users(SysadminDashboardView):
if '@' in uname:
try:
user = User.objects.get(email=uname)
except User.DoesNotExist, err:
except User.DoesNotExist as err:
msg = _('Cannot find user with email address {email_addr}').format(email_addr=uname)
return msg
else:
try:
user = User.objects.get(username=uname)
except User.DoesNotExist, err:
except User.DoesNotExist as err:
msg = _('Cannot find user with username {username} - {error}').format(
username=uname,
error=str(err)
@@ -482,7 +483,7 @@ class Courses(SysadminDashboardView):
try:
course = get_course_by_id(course_key)
course_found = True
except Exception, err: # pylint: disable=broad-except
except Exception as err: # pylint: disable=broad-except
self.msg += _(
'Error - cannot get course with ID {0}<br/><pre>{1}</pre>'
).format(

View File

@@ -1,6 +1,7 @@
"""
Views related to EdxNotes.
"""
from __future__ import absolute_import
import json
import logging

View File

@@ -1,3 +1,4 @@
from __future__ import absolute_import
import collections
import json
import logging
@@ -10,6 +11,7 @@ from opaque_keys.edx.keys import CourseKey
from courseware.courses import get_course_with_access
from notes.models import Note
from notes.utils import notes_enabled_for_course
import six
log = logging.getLogger(__name__)
@@ -50,7 +52,7 @@ def api_request(request, course_id, **kwargs):
Raises a 404 if the requested resource does not exist or notes are
disabled for the course.
'''
assert isinstance(course_id, basestring)
assert isinstance(course_id, six.string_types)
course_key = CourseKey.from_string(course_id)
# Verify that the api should be accessible to this course
@@ -68,7 +70,7 @@ def api_request(request, course_id, **kwargs):
log.debug('Resource "{0}" does not exist'.format(resource_name))
raise Http404
if resource_method not in resource.keys():
if resource_method not in list(resource.keys()):
log.debug('Resource "{0}" does not support method "{1}"'.format(resource_name, resource_method))
raise Http404

View File

@@ -1,3 +1,4 @@
from __future__ import absolute_import
import itertools
import ddt
@@ -18,6 +19,8 @@ from student.tests.factories import CourseEnrollmentFactory, UserFactory
from util.testing import UrlResetMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
import six
from six.moves import range
@ddt.ddt
@@ -102,7 +105,7 @@ class NotifierUsersViewSetTest(UrlResetMixin, ModuleStoreTestCase):
itertools.product([True, False], [True, False], [True, False])
):
self._set_up_course(is_course_cohorted, is_user_cohorted, is_moderator)
expected_course_info[unicode(self.courses[-1].id)] = {
expected_course_info[six.text_type(self.courses[-1].id)] = {
"cohort_id": self.cohorts[-1].id if is_user_cohorted else None,
"see_all_cohorts": is_moderator or not is_course_cohorted
}
@@ -114,7 +117,7 @@ class NotifierUsersViewSetTest(UrlResetMixin, ModuleStoreTestCase):
course_id = self.courses[0].id
CourseEnrollment.unenroll(self.user, course_id)
result = self._get_detail()
self.assertNotIn(unicode(course_id), result["course_info"])
self.assertNotIn(six.text_type(course_id), result["course_info"])
def test_course_info_no_enrollments(self):
result = self._get_detail()
@@ -195,11 +198,11 @@ class NotifierUsersViewSetTest(UrlResetMixin, ModuleStoreTestCase):
self.assertEqual(
result_map[self.user.id]["course_info"],
{
unicode(self.courses[0].id): {
six.text_type(self.courses[0].id): {
"cohort_id": self.cohorts[0].id,
"see_all_cohorts": False,
},
unicode(self.courses[1].id): {
six.text_type(self.courses[1].id): {
"cohort_id": None,
"see_all_cohorts": True,
},
@@ -208,7 +211,7 @@ class NotifierUsersViewSetTest(UrlResetMixin, ModuleStoreTestCase):
self.assertEqual(
result_map[other_user.id]["course_info"],
{
unicode(self.courses[0].id): {
six.text_type(self.courses[0].id): {
"cohort_id": None,
"see_all_cohorts": False,
},

View File

@@ -1,4 +1,5 @@
"""Admin views for API managment."""
from __future__ import absolute_import
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin
from django.urls import reverse

View File

@@ -1,3 +1,4 @@
from __future__ import absolute_import
from django.conf import settings
from django.core.management import call_command
from django.http import Http404, HttpResponse