Skip to content
Snippets Groups Projects
Unverified Commit 88471575 authored by M. Zulqarnain's avatar M. Zulqarnain Committed by GitHub
Browse files

refactor: pyupgrade in CMS (#26723)

parent e19ba34f
No related branches found
Tags release-2021-03-02-08.26
No related merge requests found
Showing
with 92 additions and 109 deletions
......@@ -11,7 +11,7 @@ workers = 7
def pre_request(worker, req):
worker.log.info("%s %s" % (req.method, req.path))
worker.log.info(f"{req.method} {req.path}")
def close_all_caches():
......
# -*- coding: utf-8 -*-
"""
Settings for Bok Choy tests that are used when running Studio.
......@@ -33,7 +32,7 @@ CONFIG_ROOT = path(__file__).abspath().dirname()
os.environ['STUDIO_CFG'] = str.format("{config_root}/{service_variant}.yml",
config_root=CONFIG_ROOT,
service_variant=os.environ['SERVICE_VARIANT'])
os.environ['REVISION_CFG'] = "{config_root}/revisions.yml".format(config_root=CONFIG_ROOT)
os.environ['REVISION_CFG'] = f"{CONFIG_ROOT}/revisions.yml"
from .production import * # pylint: disable=wildcard-import, unused-wildcard-import, wrong-import-position
......@@ -64,10 +63,10 @@ XBLOCK_SETTINGS.update({'VideoBlock': {'licensing_enabled': True}})
# Capture the console log via template includes, until webdriver supports log capture again
CAPTURE_CONSOLE_LOG = True
PLATFORM_NAME = ugettext_lazy(u"édX")
PLATFORM_DESCRIPTION = ugettext_lazy(u"Open édX Platform")
STUDIO_NAME = ugettext_lazy(u"Your Platform 𝓢𝓽𝓾𝓭𝓲𝓸")
STUDIO_SHORT_NAME = ugettext_lazy(u"𝓢𝓽𝓾𝓭𝓲𝓸")
PLATFORM_NAME = ugettext_lazy("édX")
PLATFORM_DESCRIPTION = ugettext_lazy("Open édX Platform")
STUDIO_NAME = ugettext_lazy("Your Platform 𝓢𝓽𝓾𝓭𝓲𝓸")
STUDIO_SHORT_NAME = ugettext_lazy("𝓢𝓽𝓾𝓭𝓲𝓸")
############################ STATIC FILES #############################
......@@ -139,9 +138,9 @@ FEATURES['ENABLE_SPECIAL_EXAMS'] = True
YOUTUBE_PORT = 9080
YOUTUBE['TEST_TIMEOUT'] = 5000
YOUTUBE_HOSTNAME = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1')
YOUTUBE['API'] = "http://{0}:{1}/get_youtube_api/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT)
YOUTUBE['METADATA_URL'] = "http://{0}:{1}/test_youtube/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT)
YOUTUBE['TEXT_API']['url'] = "{0}:{1}/test_transcripts_youtube/".format(YOUTUBE_HOSTNAME, YOUTUBE_PORT)
YOUTUBE['API'] = f"http://{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/get_youtube_api/"
YOUTUBE['METADATA_URL'] = f"http://{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/test_youtube/"
YOUTUBE['TEXT_API']['url'] = f"{YOUTUBE_HOSTNAME}:{YOUTUBE_PORT}/test_transcripts_youtube/"
FEATURES['ENABLE_COURSEWARE_INDEX'] = True
FEATURES['ENABLE_LIBRARY_INDEX'] = True
......
# -*- coding: utf-8 -*-
"""
Settings for Bok Choy tests that are used when running Studio in Docker-based devstack.
"""
......@@ -8,7 +7,7 @@ from .bok_choy import * # pylint: disable=wildcard-import
CMS_BASE = '{}:{}'.format(os.environ['BOK_CHOY_HOSTNAME'], os.environ.get('BOK_CHOY_CMS_PORT', 8031))
LMS_BASE = '{}:{}'.format(os.environ['BOK_CHOY_HOSTNAME'], os.environ.get('BOK_CHOY_LMS_PORT', 8003))
LMS_ROOT_URL = 'http://{}'.format(LMS_BASE)
LMS_ROOT_URL = f'http://{LMS_BASE}'
LOGIN_REDIRECT_WHITELIST = [CMS_BASE]
COMMENTS_SERVICE_URL = 'http://{}:4567'.format(os.environ['BOK_CHOY_HOSTNAME'])
......@@ -23,6 +22,6 @@ LOGGING['loggers']['tracking']['handlers'] = ['console']
# Point the URL used to test YouTube availability to our stub YouTube server
BOK_CHOY_HOST = os.environ['BOK_CHOY_HOSTNAME']
YOUTUBE['API'] = "http://{}:{}/get_youtube_api/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
YOUTUBE['METADATA_URL'] = "http://{}:{}/test_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
YOUTUBE['TEXT_API']['url'] = "{}:{}/test_transcripts_youtube/".format(BOK_CHOY_HOST, YOUTUBE_PORT)
YOUTUBE['API'] = f"http://{BOK_CHOY_HOST}:{YOUTUBE_PORT}/get_youtube_api/"
YOUTUBE['METADATA_URL'] = f"http://{BOK_CHOY_HOST}:{YOUTUBE_PORT}/test_youtube/"
YOUTUBE['TEXT_API']['url'] = f"{BOK_CHOY_HOST}:{YOUTUBE_PORT}/test_transcripts_youtube/"
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
......@@ -2031,7 +2030,7 @@ MANUAL_ENROLLMENT_ROLE_CHOICES = ['Learner', 'Support', 'Partner']
############## Settings for the Discovery App ######################
COURSE_CATALOG_URL_ROOT = 'http://localhost:8008'
COURSE_CATALOG_API_URL = '{}/api/v1'.format(COURSE_CATALOG_URL_ROOT)
COURSE_CATALOG_API_URL = f'{COURSE_CATALOG_URL_ROOT}/api/v1'
# which access.py permission name to check in order to determine if a course is visible in
# the course catalog. We default this to the legacy permission 'see_exists'.
......
......@@ -44,7 +44,7 @@ EMAIL_FILE_PATH = '/edx/src/ace_messages/'
################################# LMS INTEGRATION #############################
LMS_BASE = 'localhost:18000'
LMS_ROOT_URL = 'http://{}'.format(LMS_BASE)
LMS_ROOT_URL = f'http://{LMS_BASE}'
FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
FRONTEND_LOGIN_URL = LMS_ROOT_URL + '/login'
......@@ -167,10 +167,10 @@ REQUIRE_DEBUG = DEBUG
########################### OAUTH2 #################################
JWT_AUTH.update({
'JWT_ISSUER': '{}/oauth2'.format(LMS_ROOT_URL),
'JWT_ISSUER': f'{LMS_ROOT_URL}/oauth2',
'JWT_ISSUERS': [{
'AUDIENCE': 'lms-key',
'ISSUER': '{}/oauth2'.format(LMS_ROOT_URL),
'ISSUER': f'{LMS_ROOT_URL}/oauth2',
'SECRET_KEY': 'lms-secret',
}],
'JWT_SECRET_KEY': 'lms-secret',
......
......@@ -42,7 +42,7 @@ EMAIL_FILE_PATH = '/edx/src/ace_messages/'
################################# LMS INTEGRATION #############################
LMS_BASE = 'localhost:8000'
LMS_ROOT_URL = 'http://{}'.format(LMS_BASE)
LMS_ROOT_URL = f'http://{LMS_BASE}'
FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
########################### PIPELINE #################################
......@@ -119,10 +119,10 @@ REQUIRE_DEBUG = DEBUG
########################### OAUTH2 #################################
JWT_AUTH.update({
'JWT_ISSUER': '{}/oauth2'.format(LMS_ROOT_URL),
'JWT_ISSUER': f'{LMS_ROOT_URL}/oauth2',
'JWT_ISSUERS': [{
'AUDIENCE': 'lms-key',
'ISSUER': '{}/oauth2'.format(LMS_ROOT_URL),
'ISSUER': f'{LMS_ROOT_URL}/oauth2',
'SECRET_KEY': 'lms-secret',
}],
'JWT_SECRET_KEY': 'lms-secret',
......
......@@ -32,7 +32,7 @@ def get_env_setting(setting):
try:
return os.environ[setting]
except KeyError:
error_msg = u"Set the %s env variable" % setting
error_msg = "Set the %s env variable" % setting
raise ImproperlyConfigured(error_msg) # lint-amnesty, pylint: disable=raise-missing-from
############### ALWAYS THE SAME ################################
......@@ -123,10 +123,10 @@ CELERYD_PREFETCH_MULTIPLIER = 1
QUEUE_VARIANT = CONFIG_PREFIX.lower()
CELERY_DEFAULT_EXCHANGE = 'edx.{0}core'.format(QUEUE_VARIANT)
CELERY_DEFAULT_EXCHANGE = f'edx.{QUEUE_VARIANT}core'
HIGH_PRIORITY_QUEUE = 'edx.{0}core.high'.format(QUEUE_VARIANT)
DEFAULT_PRIORITY_QUEUE = 'edx.{0}core.default'.format(QUEUE_VARIANT)
HIGH_PRIORITY_QUEUE = f'edx.{QUEUE_VARIANT}core.high'
DEFAULT_PRIORITY_QUEUE = f'edx.{QUEUE_VARIANT}core.default'
CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
......@@ -402,11 +402,11 @@ CELERY_BROKER_VHOST = ENV_TOKENS.get("CELERY_BROKER_VHOST", "")
CELERY_BROKER_USER = AUTH_TOKENS.get("CELERY_BROKER_USER", "")
CELERY_BROKER_PASSWORD = AUTH_TOKENS.get("CELERY_BROKER_PASSWORD", "")
BROKER_URL = "{0}://{1}:{2}@{3}/{4}".format(CELERY_BROKER_TRANSPORT,
CELERY_BROKER_USER,
CELERY_BROKER_PASSWORD,
CELERY_BROKER_HOSTNAME,
CELERY_BROKER_VHOST)
BROKER_URL = "{}://{}:{}@{}/{}".format(CELERY_BROKER_TRANSPORT,
CELERY_BROKER_USER,
CELERY_BROKER_PASSWORD,
CELERY_BROKER_HOSTNAME,
CELERY_BROKER_VHOST)
BROKER_USE_SSL = ENV_TOKENS.get('CELERY_BROKER_USE_SSL', False)
BROKER_TRANSPORT_OPTIONS = {
......
# -*- coding: utf-8 -*-
"""
This config file runs the simplest dev environment using sqlite, and db-based
sessions. Assumes structure:
......@@ -47,8 +46,8 @@ from lms.envs.test import ( # pylint: disable=wrong-import-order
# Include a non-ascii character in STUDIO_NAME and STUDIO_SHORT_NAME to uncover possible
# UnicodeEncodeErrors in tests. Also use lazy text to reveal possible json dumps errors
STUDIO_NAME = ugettext_lazy(u"Your Platform 𝓢𝓽𝓾𝓭𝓲𝓸")
STUDIO_SHORT_NAME = ugettext_lazy(u"𝓢𝓽𝓾𝓭𝓲𝓸")
STUDIO_NAME = ugettext_lazy("Your Platform 𝓢𝓽𝓾𝓭𝓲𝓸")
STUDIO_SHORT_NAME = ugettext_lazy("𝓢𝓽𝓾𝓭𝓲𝓸")
# Allow all hosts during tests, we use a lot of different ones all over the codebase.
ALLOWED_HOSTS = [
......@@ -103,7 +102,7 @@ update_module_store_settings(
'fs_root': TEST_ROOT / "data",
},
doc_store_settings={
'db': 'test_xmodule_{}'.format(THIS_UUID),
'db': f'test_xmodule_{THIS_UUID}',
'host': MONGO_HOST,
'port': MONGO_PORT_NUM,
'collection': 'test_modulestore',
......@@ -114,7 +113,7 @@ CONTENTSTORE = {
'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore',
'DOC_STORE_CONFIG': {
'host': MONGO_HOST,
'db': 'test_xcontent_{}'.format(THIS_UUID),
'db': f'test_xcontent_{THIS_UUID}',
'port': MONGO_PORT_NUM,
'collection': 'dont_trip',
},
......@@ -135,7 +134,7 @@ DATABASES = {
}
LMS_BASE = "localhost:8000"
LMS_ROOT_URL = "http://{}".format(LMS_BASE)
LMS_ROOT_URL = f"http://{LMS_BASE}"
FEATURES['PREVIEW_LMS_BASE'] = "preview.localhost"
COURSE_AUTHORING_MICROFRONTEND_URL = "http://course-authoring-mfe"
......
......@@ -21,7 +21,7 @@ class CmsFieldData(SplitFieldData):
self._authored_data = authored_data
self._student_data = student_data
super(CmsFieldData, self).__init__({ # lint-amnesty, pylint: disable=super-with-arguments
super().__init__({
Scope.content: authored_data,
Scope.settings: authored_data,
Scope.parent: authored_data,
......
......@@ -4,7 +4,6 @@ XBlock runtime implementations for edX Studio
import logging
import six
from django.urls import reverse
log = logging.getLogger(__name__)
......@@ -19,7 +18,7 @@ def handler_url(block, handler_name, suffix='', query='', thirdparty=False):
log.warning("edX Studio doesn't support third-party handler urls for XBlock %s", type(block))
url = reverse('component_handler', kwargs={
'usage_key_string': six.text_type(block.scope_ids.usage_id),
'usage_key_string': str(block.scope_ids.usage_id),
'handler': handler_name,
'suffix': suffix,
}).rstrip('/')
......
# -*- coding: utf-8 -*-
"""
Structured Tagging based on XBlockAsides
"""
......
# -*- coding: utf-8 -*-
from django.db import migrations, models
......
# -*- coding: utf-8 -*-
from django.db import migrations, models
......
......@@ -17,14 +17,14 @@ class TagCategories(models.Model):
name = models.CharField(max_length=255, unique=True)
title = models.CharField(max_length=255)
class Meta(object):
class Meta:
app_label = "tagging"
ordering = ('title',)
verbose_name = "tag category"
verbose_name_plural = "tag categories"
def __str__(self):
return "[TagCategories] {}: {}".format(self.name, self.title)
return f"[TagCategories] {self.name}: {self.title}"
def get_values(self):
"""
......@@ -43,10 +43,10 @@ class TagAvailableValues(models.Model):
category = models.ForeignKey(TagCategories, db_index=True, on_delete=models.CASCADE)
value = models.CharField(max_length=255)
class Meta(object):
class Meta:
app_label = "tagging"
ordering = ('id',)
verbose_name = "available tag value"
def __str__(self):
return "[TagAvailableValues] {}: {}".format(self.category, self.value)
return f"[TagAvailableValues] {self.category}: {self.value}"
# -*- coding: utf-8 -*-
"""
Structured Tagging based on XBlockAsides
"""
import six
from django.conf import settings
from web_fragments.fragment import Fragment
from webob import Response
......@@ -52,7 +48,7 @@ class StructuredTagsAside(XBlockAside):
tag_available_values = tag.get_values()
tag_current_values = self.saved_tags.get(tag.name, [])
if isinstance(tag_current_values, six.string_types):
if isinstance(tag_current_values, str):
tag_current_values = [tag_current_values]
tag_values_not_exists = [cur_val for cur_val in tag_current_values
......@@ -74,7 +70,7 @@ class StructuredTagsAside(XBlockAside):
fragment.initialize_js('StructuredTagsInit')
return fragment
else:
return Fragment(u'')
return Fragment('')
@XBlock.handler
def save_tags(self, request=None, suffix=None): # lint-amnesty, pylint: disable=unused-argument
......@@ -94,12 +90,12 @@ class StructuredTagsAside(XBlockAside):
tag_available_values = av_tag.get_values()
tag_current_values = self.saved_tags.get(av_tag.name, [])
if isinstance(tag_current_values, six.string_types):
if isinstance(tag_current_values, str):
tag_current_values = [tag_current_values]
for posted_tag_value in posted_data[av_tag.name]:
if posted_tag_value not in tag_available_values and posted_tag_value not in tag_current_values:
return Response(u"Invalid tag value was passed: %s" % posted_tag_value, status=400)
return Response("Invalid tag value was passed: %s" % posted_tag_value, status=400)
saved_tags[av_tag.name] = posted_data[av_tag.name]
need_update = True
......
......@@ -5,14 +5,13 @@ Tests for the Studio Tagging XBlockAside
import json
from datetime import datetime
from io import StringIO
import ddt
import six
from django.test.client import RequestFactory
from lxml import etree
from opaque_keys.edx.asides import AsideUsageKeyV1, AsideUsageKeyV2
from pytz import UTC
from six import StringIO
from xblock.fields import ScopeIds
from xblock.runtime import DictKeyValueStore, KvsFieldData
from xblock.test.tools import TestRuntime
......@@ -39,7 +38,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
"""
Preparation for the test execution
"""
super(StructuredTagsAsideTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.aside_name = 'tagging_aside'
self.aside_tag_dif = 'difficulty'
self.aside_tag_dif_value = 'Hard'
......@@ -113,7 +112,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
def tearDown(self):
TagAvailableValues.objects.all().delete()
TagCategories.objects.all().delete()
super(StructuredTagsAsideTestCase, self).tearDown() # lint-amnesty, pylint: disable=super-with-arguments
super().tearDown()
def test_aside_contains_tags(self):
"""
......@@ -194,7 +193,7 @@ class StructuredTagsAsideTestCase(ModuleStoreTestCase):
"""
handler_url = reverse_usage_url(
'component_handler',
six.text_type(aside_key_class(self.problem.location, self.aside_name)),
str(aside_key_class(self.problem.location, self.aside_name)),
kwargs={'handler': 'save_tags'}
)
......
......@@ -36,7 +36,7 @@ class AuthoringMixinTestCase(ModuleStoreTestCase):
"""
Create a simple course with a video component.
"""
super(AuthoringMixinTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.course = CourseFactory.create()
chapter = ItemFactory.create(
category='chapter',
......
......@@ -4,9 +4,9 @@ Tests of edX Studio runtime functionality
from unittest import TestCase
from urllib.parse import urlparse
from mock import Mock
from six.moves.urllib.parse import urlparse
from unittest.mock import Mock
from cms.lib.xblock.runtime import handler_url
......@@ -15,7 +15,7 @@ class TestHandlerUrl(TestCase):
"""Test the LMS handler_url"""
def setUp(self):
super(TestHandlerUrl, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.block = Mock()
def test_trailing_characters(self):
......
......@@ -89,89 +89,89 @@ urlpatterns = [
url(r'^howitworks$', contentstore_views.howitworks, name='howitworks'),
url(r'^signin_redirect_to_lms$', contentstore_views.login_redirect_to_lms, name='login_redirect_to_lms'),
url(r'^request_course_creator$', contentstore_views.request_course_creator, name='request_course_creator'),
url(r'^course_team/{}(?:/(?P<email>.+))?$'.format(COURSELIKE_KEY_PATTERN),
url(fr'^course_team/{COURSELIKE_KEY_PATTERN}(?:/(?P<email>.+))?$',
contentstore_views.course_team_handler, name='course_team_handler'),
url(r'^course_info/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.course_info_handler,
url(fr'^course_info/{settings.COURSE_KEY_PATTERN}$', contentstore_views.course_info_handler,
name='course_info_handler'),
url(r'^course_info_update/{}/(?P<provided_id>\d+)?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^course_info_update/{settings.COURSE_KEY_PATTERN}/(?P<provided_id>\d+)?$',
contentstore_views.course_info_update_handler, name='course_info_update_handler'
),
url(r'^home/?$', contentstore_views.course_listing, name='home'),
url(r'^home_library/?$', contentstore_views.library_listing, name='home_library'),
url(r'^course/{}/search_reindex?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^course/{settings.COURSE_KEY_PATTERN}/search_reindex?$',
contentstore_views.course_search_index_handler,
name='course_search_index_handler'
),
url(r'^course/{}?$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.course_handler, name='course_handler'),
url(fr'^course/{settings.COURSE_KEY_PATTERN}?$', contentstore_views.course_handler, name='course_handler'),
url(r'^checklists/{}?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^checklists/{settings.COURSE_KEY_PATTERN}?$',
contentstore_views.checklists_handler,
name='checklists_handler'),
url(r'^course_notifications/{}/(?P<action_state_id>\d+)?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^course_notifications/{settings.COURSE_KEY_PATTERN}/(?P<action_state_id>\d+)?$',
contentstore_views.course_notifications_handler,
name='course_notifications_handler'),
url(r'^course_rerun/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.course_rerun_handler,
url(fr'^course_rerun/{settings.COURSE_KEY_PATTERN}$', contentstore_views.course_rerun_handler,
name='course_rerun_handler'),
url(r'^container/{}$'.format(settings.USAGE_KEY_PATTERN), contentstore_views.container_handler,
url(fr'^container/{settings.USAGE_KEY_PATTERN}$', contentstore_views.container_handler,
name='container_handler'),
url(r'^orphan/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.orphan_handler,
url(fr'^orphan/{settings.COURSE_KEY_PATTERN}$', contentstore_views.orphan_handler,
name='orphan_handler'),
url(r'^assets/{}/{}?$'.format(settings.COURSE_KEY_PATTERN, settings.ASSET_KEY_PATTERN),
url(fr'^assets/{settings.COURSE_KEY_PATTERN}/{settings.ASSET_KEY_PATTERN}?$',
contentstore_views.assets_handler,
name='assets_handler'),
url(r'^import/{}$'.format(COURSELIKE_KEY_PATTERN), contentstore_views.import_handler,
url(fr'^import/{COURSELIKE_KEY_PATTERN}$', contentstore_views.import_handler,
name='import_handler'),
url(r'^import_status/{}/(?P<filename>.+)$'.format(COURSELIKE_KEY_PATTERN),
url(fr'^import_status/{COURSELIKE_KEY_PATTERN}/(?P<filename>.+)$',
contentstore_views.import_status_handler, name='import_status_handler'),
# rest api for course import/export
url(r'^api/courses/',
include('cms.djangoapps.contentstore.api.urls', namespace='courses_api')
),
url(r'^export/{}$'.format(COURSELIKE_KEY_PATTERN), contentstore_views.export_handler,
url(fr'^export/{COURSELIKE_KEY_PATTERN}$', contentstore_views.export_handler,
name='export_handler'),
url(r'^export_output/{}$'.format(COURSELIKE_KEY_PATTERN), contentstore_views.export_output_handler,
url(fr'^export_output/{COURSELIKE_KEY_PATTERN}$', contentstore_views.export_output_handler,
name='export_output_handler'),
url(r'^export_status/{}$'.format(COURSELIKE_KEY_PATTERN), contentstore_views.export_status_handler,
url(fr'^export_status/{COURSELIKE_KEY_PATTERN}$', contentstore_views.export_status_handler,
name='export_status_handler'),
url(r'^xblock/outline/{}$'.format(settings.USAGE_KEY_PATTERN), contentstore_views.xblock_outline_handler,
url(fr'^xblock/outline/{settings.USAGE_KEY_PATTERN}$', contentstore_views.xblock_outline_handler,
name='xblock_outline_handler'),
url(r'^xblock/container/{}$'.format(settings.USAGE_KEY_PATTERN), contentstore_views.xblock_container_handler,
url(fr'^xblock/container/{settings.USAGE_KEY_PATTERN}$', contentstore_views.xblock_container_handler,
name='xblock_container_handler'),
url(r'^xblock/{}/(?P<view_name>[^/]+)$'.format(settings.USAGE_KEY_PATTERN), contentstore_views.xblock_view_handler,
url(fr'^xblock/{settings.USAGE_KEY_PATTERN}/(?P<view_name>[^/]+)$', contentstore_views.xblock_view_handler,
name='xblock_view_handler'),
url(r'^xblock/{}?$'.format(settings.USAGE_KEY_PATTERN), contentstore_views.xblock_handler,
url(fr'^xblock/{settings.USAGE_KEY_PATTERN}?$', contentstore_views.xblock_handler,
name='xblock_handler'),
url(r'^tabs/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.tabs_handler,
url(fr'^tabs/{settings.COURSE_KEY_PATTERN}$', contentstore_views.tabs_handler,
name='tabs_handler'),
url(r'^settings/details/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.settings_handler,
url(fr'^settings/details/{settings.COURSE_KEY_PATTERN}$', contentstore_views.settings_handler,
name='settings_handler'),
url(r'^settings/grading/{}(/)?(?P<grader_index>\d+)?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^settings/grading/{settings.COURSE_KEY_PATTERN}(/)?(?P<grader_index>\d+)?$',
contentstore_views.grading_handler, name='grading_handler'),
url(r'^settings/advanced/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.advanced_settings_handler,
url(fr'^settings/advanced/{settings.COURSE_KEY_PATTERN}$', contentstore_views.advanced_settings_handler,
name='advanced_settings_handler'),
url(r'^textbooks/{}$'.format(settings.COURSE_KEY_PATTERN), contentstore_views.textbooks_list_handler,
url(fr'^textbooks/{settings.COURSE_KEY_PATTERN}$', contentstore_views.textbooks_list_handler,
name='textbooks_list_handler'),
url(r'^textbooks/{}/(?P<textbook_id>\d[^/]*)$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^textbooks/{settings.COURSE_KEY_PATTERN}/(?P<textbook_id>\d[^/]*)$',
contentstore_views.textbooks_detail_handler, name='textbooks_detail_handler'),
url(r'^videos/{}(?:/(?P<edx_video_id>[-\w]+))?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^videos/{settings.COURSE_KEY_PATTERN}(?:/(?P<edx_video_id>[-\w]+))?$',
contentstore_views.videos_handler, name='videos_handler'),
url(r'^generate_video_upload_link/{}'.format(settings.COURSE_KEY_PATTERN),
url(fr'^generate_video_upload_link/{settings.COURSE_KEY_PATTERN}',
contentstore_views.generate_video_upload_link_handler, name='generate_video_upload_link'),
url(r'^video_images/{}(?:/(?P<edx_video_id>[-\w]+))?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^video_images/{settings.COURSE_KEY_PATTERN}(?:/(?P<edx_video_id>[-\w]+))?$',
contentstore_views.video_images_handler, name='video_images_handler'),
url(r'^transcript_preferences/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^transcript_preferences/{settings.COURSE_KEY_PATTERN}$',
contentstore_views.transcript_preferences_handler, name='transcript_preferences_handler'),
url(r'^transcript_credentials/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^transcript_credentials/{settings.COURSE_KEY_PATTERN}$',
contentstore_views.transcript_credentials_handler, name='transcript_credentials_handler'),
url(r'^transcript_download/$', contentstore_views.transcript_download_handler, name='transcript_download_handler'),
url(r'^transcript_upload/$', contentstore_views.transcript_upload_handler, name='transcript_upload_handler'),
url(r'^transcript_delete/{}(?:/(?P<edx_video_id>[-\w]+))?(?:/(?P<language_code>[^/]*))?$'.format(
settings.COURSE_KEY_PATTERN
), contentstore_views.transcript_delete_handler, name='transcript_delete_handler'),
url(r'^video_encodings_download/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^video_encodings_download/{settings.COURSE_KEY_PATTERN}$',
contentstore_views.video_encodings_download, name='video_encodings_download'),
url(r'^group_configurations/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^group_configurations/{settings.COURSE_KEY_PATTERN}$',
contentstore_views.group_configurations_list_handler,
name='group_configurations_list_handler'),
url(r'^group_configurations/{}/(?P<group_configuration_id>\d+)(/)?(?P<group_id>\d+)?$'.format(
......@@ -206,15 +206,15 @@ urlpatterns += [
if settings.FEATURES.get('ENABLE_CONTENT_LIBRARIES'):
urlpatterns += [
url(r'^library/{}?$'.format(LIBRARY_KEY_PATTERN),
url(fr'^library/{LIBRARY_KEY_PATTERN}?$',
contentstore_views.library_handler, name='library_handler'),
url(r'^library/{}/team/$'.format(LIBRARY_KEY_PATTERN),
url(fr'^library/{LIBRARY_KEY_PATTERN}/team/$',
contentstore_views.manage_library_users, name='manage_library_users'),
]
if toggles.EXPORT_GIT.is_enabled():
urlpatterns += [
url(r'^export_git/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^export_git/{settings.COURSE_KEY_PATTERN}$',
contentstore_views.export_git,
name='export_git')
]
......@@ -231,7 +231,7 @@ urlpatterns.append(url(r'^admin/', admin.site.urls))
# enable entrance exams
if core_toggles.ENTRANCE_EXAMS.is_enabled():
urlpatterns.append(url(r'^course/{}/entrance_exam/?$'.format(settings.COURSE_KEY_PATTERN),
urlpatterns.append(url(fr'^course/{settings.COURSE_KEY_PATTERN}/entrance_exam/?$',
contentstore_views.entrance_exam))
# Enable Web/HTML Certificates
......@@ -244,14 +244,14 @@ if settings.FEATURES.get('CERTIFICATES_HTML_VIEW'):
)
urlpatterns += [
url(r'^certificates/activation/{}/'.format(settings.COURSE_KEY_PATTERN),
url(fr'^certificates/activation/{settings.COURSE_KEY_PATTERN}/',
certificate_activation_handler,
name='certificate_activation_handler'),
url(r'^certificates/{}/(?P<certificate_id>\d+)/signatories/(?P<signatory_id>\d+)?$'.format(
settings.COURSE_KEY_PATTERN), signatory_detail_handler, name='signatory_detail_handler'),
url(r'^certificates/{}/(?P<certificate_id>\d+)?$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^certificates/{settings.COURSE_KEY_PATTERN}/(?P<certificate_id>\d+)?$',
certificates_detail_handler, name='certificates_detail_handler'),
url(r'^certificates/{}$'.format(settings.COURSE_KEY_PATTERN),
url(fr'^certificates/{settings.COURSE_KEY_PATTERN}$',
certificates_list_handler, name='certificates_list_handler')
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment