diff --git a/cms/djangoapps/auth/authz.py b/cms/djangoapps/auth/authz.py index 281e3f46b2..71b5e97bc2 100644 --- a/cms/djangoapps/auth/authz.py +++ b/cms/djangoapps/auth/authz.py @@ -1,6 +1,3 @@ -import logging -import sys - from django.contrib.auth.models import User, Group from django.core.exceptions import PermissionDenied @@ -131,7 +128,7 @@ def remove_user_from_course_group(caller, user, location, role): raise PermissionDenied # see if the user is actually in that role, if not then we don't have to do anything - if is_user_in_course_group_role(user, location, role) == True: + if is_user_in_course_group_role(user, location, role): groupname = get_course_groupname_for_role(location, role) group = Group.objects.get(name=groupname) diff --git a/cms/djangoapps/contentstore/features/checklists.py b/cms/djangoapps/contentstore/features/checklists.py index dc399f5fac..489544f424 100644 --- a/cms/djangoapps/contentstore/features/checklists.py +++ b/cms/djangoapps/contentstore/features/checklists.py @@ -6,6 +6,7 @@ from nose.tools import assert_true, assert_equal from terrain.steps import reload_the_page from selenium.common.exceptions import StaleElementReferenceException + ############### ACTIONS #################### @step('I select Checklists from the Tools menu$') def i_select_checklists(step): diff --git a/cms/djangoapps/contentstore/management/commands/check_course.py b/cms/djangoapps/contentstore/management/commands/check_course.py index 57965fe793..215bb8add8 100644 --- a/cms/djangoapps/contentstore/management/commands/check_course.py +++ b/cms/djangoapps/contentstore/management/commands/check_course.py @@ -59,7 +59,7 @@ class Command(BaseCommand): discussion_items = _get_discussion_items(course) # now query all discussion items via get_items() and compare with the tree-traversal - queried_discussion_items = store.get_items(['i4x', course.location.org, course.location.course, + queried_discussion_items = store.get_items(['i4x', course.location.org, course.location.course, 'discussion', None, None]) for item in queried_discussion_items: diff --git a/cms/djangoapps/contentstore/management/commands/clone.py b/cms/djangoapps/contentstore/management/commands/clone.py index abf04f3da3..0ca50acb50 100644 --- a/cms/djangoapps/contentstore/management/commands/clone.py +++ b/cms/djangoapps/contentstore/management/commands/clone.py @@ -5,7 +5,6 @@ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.store_utilities import clone_course from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore -from xmodule.modulestore import Location from xmodule.course_module import CourseDescriptor from auth.authz import _copy_course_group @@ -16,8 +15,7 @@ from auth.authz import _copy_course_group class Command(BaseCommand): - help = \ -'''Clone a MongoDB backed course to another location''' + help = 'Clone a MongoDB backed course to another location' def handle(self, *args, **options): if len(args) != 2: diff --git a/cms/djangoapps/contentstore/management/commands/delete_course.py b/cms/djangoapps/contentstore/management/commands/delete_course.py index fc92205030..5aafe9f8a6 100644 --- a/cms/djangoapps/contentstore/management/commands/delete_course.py +++ b/cms/djangoapps/contentstore/management/commands/delete_course.py @@ -5,7 +5,6 @@ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.store_utilities import delete_course from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore -from xmodule.modulestore import Location from xmodule.course_module import CourseDescriptor from .prompt import query_yes_no @@ -38,7 +37,7 @@ class Command(BaseCommand): if query_yes_no("Deleting course {0}. Confirm?".format(loc_str), default="no"): if query_yes_no("Are you sure. This action cannot be undone!", default="no"): loc = CourseDescriptor.id_to_location(loc_str) - if delete_course(ms, cs, loc, commit) == True: + if delete_course(ms, cs, loc, commit): print 'removing User permissions from course....' # in the django layer, we need to remove all the user permissions groups associated with this course if commit: diff --git a/cms/djangoapps/contentstore/management/commands/export.py b/cms/djangoapps/contentstore/management/commands/export.py index 11b043c2ab..eb7800d46c 100644 --- a/cms/djangoapps/contentstore/management/commands/export.py +++ b/cms/djangoapps/contentstore/management/commands/export.py @@ -7,7 +7,6 @@ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.xml_exporter import export_to_xml from xmodule.modulestore.django import modulestore from xmodule.contentstore.django import contentstore -from xmodule.modulestore import Location from xmodule.course_module import CourseDescriptor @@ -15,8 +14,7 @@ unnamed_modules = 0 class Command(BaseCommand): - help = \ -'''Import the specified data directory into the default ModuleStore''' + help = 'Import the specified data directory into the default ModuleStore' def handle(self, *args, **options): if len(args) != 2: diff --git a/cms/djangoapps/contentstore/management/commands/import.py b/cms/djangoapps/contentstore/management/commands/import.py index 2a040f35b6..9b919daad0 100644 --- a/cms/djangoapps/contentstore/management/commands/import.py +++ b/cms/djangoapps/contentstore/management/commands/import.py @@ -12,8 +12,7 @@ unnamed_modules = 0 class Command(BaseCommand): - help = \ -'''Import the specified data directory into the default ModuleStore''' + help = 'Import the specified data directory into the default ModuleStore' def handle(self, *args, **options): if len(args) == 0: @@ -28,4 +27,4 @@ class Command(BaseCommand): data=data_dir, courses=course_dirs) import_from_xml(modulestore('direct'), data_dir, course_dirs, load_error_modules=False, - static_content_store=contentstore(), verbose=True) + static_content_store=contentstore(), verbose=True) diff --git a/cms/djangoapps/contentstore/management/commands/prompt.py b/cms/djangoapps/contentstore/management/commands/prompt.py index 40a39d0a11..44f981b5ac 100644 --- a/cms/djangoapps/contentstore/management/commands/prompt.py +++ b/cms/djangoapps/contentstore/management/commands/prompt.py @@ -11,8 +11,8 @@ def query_yes_no(question, default="yes"): The "answer" return value is one of "yes" or "no". """ - valid = {"yes":True, "y":True, "ye":True, - "no":False, "n":False} + valid = {"yes": True, "y": True, "ye": True, + "no": False, "n": False} if default is None: prompt = " [y/n] " elif default == "yes": @@ -30,5 +30,4 @@ def query_yes_no(question, default="yes"): elif choice in valid: return valid[choice] else: - sys.stdout.write("Please respond with 'yes' or 'no' "\ - "(or 'y' or 'n').\n") + sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n") diff --git a/cms/djangoapps/contentstore/management/commands/update_templates.py b/cms/djangoapps/contentstore/management/commands/update_templates.py index b30d30480a..e94fee64b8 100644 --- a/cms/djangoapps/contentstore/management/commands/update_templates.py +++ b/cms/djangoapps/contentstore/management/commands/update_templates.py @@ -1,9 +1,9 @@ from xmodule.templates import update_templates from django.core.management.base import BaseCommand + class Command(BaseCommand): - help = \ -'''Imports and updates the Studio component templates from the code pack and put in the DB''' + help = 'Imports and updates the Studio component templates from the code pack and put in the DB' def handle(self, *args, **options): - update_templates() \ No newline at end of file + update_templates() diff --git a/cms/djangoapps/contentstore/management/commands/xlint.py b/cms/djangoapps/contentstore/management/commands/xlint.py index 6bc254a1ff..21c8e7d1f8 100644 --- a/cms/djangoapps/contentstore/management/commands/xlint.py +++ b/cms/djangoapps/contentstore/management/commands/xlint.py @@ -1,7 +1,5 @@ from django.core.management.base import BaseCommand, CommandError from xmodule.modulestore.xml_importer import perform_xlint -from xmodule.modulestore.django import modulestore -from xmodule.contentstore.django import contentstore unnamed_modules = 0 @@ -9,10 +7,11 @@ unnamed_modules = 0 class Command(BaseCommand): help = \ - ''' - Verify the structure of courseware as to it's suitability for import - To run test: rake cms:xlint DATA_DIR=../data [COURSE_DIR=content-edx-101 (optional parameter)] - ''' + ''' + Verify the structure of courseware as to it's suitability for import + To run test: rake cms:xlint DATA_DIR=../data [COURSE_DIR=content-edx-101 (optional parameter)] + ''' + def handle(self, *args, **options): if len(args) == 0: raise CommandError("import requires at least one argument: [...]") diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 1d3fca1bcc..4908b9e417 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -6,12 +6,11 @@ from django.conf import settings from django.core.urlresolvers import reverse from path import path from tempdir import mkdtemp_clean -from datetime import timedelta -import json from fs.osfs import OSFS import copy from json import loads import traceback +from datetime import timedelta from django.contrib.auth.models import User from django.dispatch import Signal @@ -39,6 +38,7 @@ TEST_DATA_MODULESTORE = copy.deepcopy(settings.MODULESTORE) TEST_DATA_MODULESTORE['default']['OPTIONS']['fs_root'] = path('common/test/data') TEST_DATA_MODULESTORE['direct']['OPTIONS']['fs_root'] = path('common/test/data') + class MongoCollectionFindWrapper(object): def __init__(self, original): self.original = original @@ -187,32 +187,31 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): def test_get_depth_with_drafts(self): import_from_xml(modulestore(), 'common/test/data/', ['simple']) - course = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', - 'course', '2012_Fall', None]), depth=None) + course = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', + 'course', '2012_Fall', None]), depth=None) # make sure no draft items have been returned num_drafts = self._get_draft_counts(course) self.assertEqual(num_drafts, 0) - problem = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', - 'problem', 'ps01-simple', None])) + problem = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', + 'problem', 'ps01-simple', None])) # put into draft modulestore('draft').clone_item(problem.location, problem.location) # make sure we can query that item and verify that it is a draft - draft_problem = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', - 'problem', 'ps01-simple', None])) - self.assertTrue(getattr(draft_problem,'is_draft', False)) + draft_problem = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', + 'problem', 'ps01-simple', None])) + self.assertTrue(getattr(draft_problem, 'is_draft', False)) #now requery with depth - course = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', - 'course', '2012_Fall', None]), depth=None) + course = modulestore('draft').get_item(Location(['i4x', 'edX', 'simple', + 'course', '2012_Fall', None]), depth=None) # make sure just one draft item have been returned num_drafts = self._get_draft_counts(course) - self.assertEqual(num_drafts, 1) - + self.assertEqual(num_drafts, 1) def test_static_tab_reordering(self): import_from_xml(modulestore(), 'common/test/data/', ['full']) @@ -268,8 +267,9 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): self.assertTrue(sequential.location.url() in chapter.children) self.client.post(reverse('delete_item'), - json.dumps({'id': sequential.location.url(), 'delete_children': 'true', 'delete_all_versions': 'true'}), - "application/json") + json.dumps({'id': sequential.location.url(), 'delete_children': 'true', + 'delete_all_versions': 'true'}), + "application/json") found = False try: @@ -387,7 +387,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): draft_store.clone_item(vertical.location, vertical.location) for child in vertical.get_children(): - draft_store.clone_item(child.location, child.location) + draft_store.clone_item(child.location, child.location) root_dir = path(mkdtemp_clean()) @@ -402,7 +402,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): module_store.update_children(sequential.location, sequential.children + [private_location_no_draft.url()]) - # read back the sequential, to make sure we have a pointer to + # read back the sequential, to make sure we have a pointer to sequential = module_store.get_item(Location(['i4x', 'edX', 'full', 'sequential', 'Administrivia_and_Circuit_Elements', None])) @@ -622,9 +622,9 @@ class ContentStoreTest(ModuleStoreTestCase): # Create a course so there is something to view resp = self.client.get(reverse('index')) self.assertContains(resp, - '

My Courses

', - status_code=200, - html=True) + '

My Courses

', + status_code=200, + html=True) def test_course_factory(self): """Test that the course factory works correctly.""" @@ -642,9 +642,9 @@ class ContentStoreTest(ModuleStoreTestCase): CourseFactory.create(display_name='Robot Super Educational Course') resp = self.client.get(reverse('index')) self.assertContains(resp, - 'Robot Super Educational Course', - status_code=200, - html=True) + 'Robot Super Educational Course', + status_code=200, + html=True) def test_course_overview_view_with_course(self): """Test viewing the course overview page with an existing course""" @@ -658,9 +658,9 @@ class ContentStoreTest(ModuleStoreTestCase): resp = self.client.get(reverse('course_index', kwargs=data)) self.assertContains(resp, - '
', - status_code=200, - html=True) + '
', + status_code=200, + html=True) def test_clone_item(self): """Test cloning an item. E.g. creating a new section""" @@ -676,8 +676,7 @@ class ContentStoreTest(ModuleStoreTestCase): self.assertEqual(resp.status_code, 200) data = parse_json(resp) - self.assertRegexpMatches(data['id'], - '^i4x:\/\/MITx\/999\/chapter\/([0-9]|[a-f]){32}$') + self.assertRegexpMatches(data['id'], '^i4x:\/\/MITx\/999\/chapter\/([0-9]|[a-f]){32}$') def test_capa_module(self): """Test that a problem treats markdown specially.""" diff --git a/cms/djangoapps/contentstore/tests/test_core_caching.py b/cms/djangoapps/contentstore/tests/test_core_caching.py index 676627a045..34ed24699d 100644 --- a/cms/djangoapps/contentstore/tests/test_core_caching.py +++ b/cms/djangoapps/contentstore/tests/test_core_caching.py @@ -23,14 +23,14 @@ class CachingTestCase(TestCase): def test_put_and_get(self): set_cached_content(self.mockAsset) self.assertEqual(self.mockAsset.content, get_cached_content(self.unicodeLocation).content, - 'should be stored in cache with unicodeLocation') + 'should be stored in cache with unicodeLocation') self.assertEqual(self.mockAsset.content, get_cached_content(self.nonUnicodeLocation).content, - 'should be stored in cache with nonUnicodeLocation') + 'should be stored in cache with nonUnicodeLocation') def test_delete(self): set_cached_content(self.mockAsset) del_cached_content(self.nonUnicodeLocation) self.assertEqual(None, get_cached_content(self.unicodeLocation), - 'should not be stored in cache with unicodeLocation') + 'should not be stored in cache with unicodeLocation') self.assertEqual(None, get_cached_content(self.nonUnicodeLocation), - 'should not be stored in cache with nonUnicodeLocation') + 'should not be stored in cache with nonUnicodeLocation') diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index fe90ad18aa..c3fa665b2c 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -8,8 +8,7 @@ from django.core.urlresolvers import reverse from django.utils.timezone import UTC from xmodule.modulestore import Location -from models.settings.course_details import (CourseDetails, - CourseSettingsEncoder) +from models.settings.course_details import (CourseDetails, CourseSettingsEncoder) from models.settings.course_grading import CourseGradingModel from contentstore.utils import get_modulestore @@ -21,6 +20,7 @@ from xmodule.modulestore.xml_importer import import_from_xml from xmodule.modulestore.django import modulestore from xmodule.fields import Date + class CourseTestCase(ModuleStoreTestCase): def setUp(self): """ @@ -87,16 +87,16 @@ class CourseDetailsTestCase(CourseTestCase): jsondetails.syllabus = "bar" # encode - decode to convert date fields and other data which changes form self.assertEqual(CourseDetails.update_from_json(jsondetails.__dict__).syllabus, - jsondetails.syllabus, "After set syllabus") + jsondetails.syllabus, "After set syllabus") jsondetails.overview = "Overview" self.assertEqual(CourseDetails.update_from_json(jsondetails.__dict__).overview, - jsondetails.overview, "After set overview") + jsondetails.overview, "After set overview") jsondetails.intro_video = "intro_video" self.assertEqual(CourseDetails.update_from_json(jsondetails.__dict__).intro_video, - jsondetails.intro_video, "After set intro_video") + jsondetails.intro_video, "After set intro_video") jsondetails.effort = "effort" self.assertEqual(CourseDetails.update_from_json(jsondetails.__dict__).effort, - jsondetails.effort, "After set effort") + jsondetails.effort, "After set effort") class CourseDetailsViewTest(CourseTestCase): @@ -151,8 +151,8 @@ class CourseDetailsViewTest(CourseTestCase): @staticmethod def struct_to_datetime(struct_time): return datetime.datetime(struct_time.tm_year, struct_time.tm_mon, - struct_time.tm_mday, struct_time.tm_hour, - struct_time.tm_min, struct_time.tm_sec, tzinfo=UTC()) + struct_time.tm_mday, struct_time.tm_hour, + struct_time.tm_min, struct_time.tm_sec, tzinfo=UTC()) def compare_date_fields(self, details, encoded, context, field): if details[field] is not None: @@ -249,6 +249,7 @@ class CourseGradingTest(CourseTestCase): altered_grader = CourseGradingModel.update_grader_from_json(test_grader.course_location, test_grader.graders[1]) self.assertDictEqual(test_grader.graders[1], altered_grader, "drop_count[1] + 2") + class CourseMetadataEditingTest(CourseTestCase): def setUp(self): CourseTestCase.setUp(self) @@ -256,7 +257,6 @@ class CourseMetadataEditingTest(CourseTestCase): import_from_xml(modulestore(), 'common/test/data/', ['full']) self.fullcourse_location = Location(['i4x', 'edX', 'full', 'course', '6.002_Spring_2012', None]) - def test_fetch_initial_fields(self): test_model = CourseMetadata.fetch(self.course_location) self.assertIn('display_name', test_model, 'Missing editable metadata field') @@ -272,17 +272,17 @@ class CourseMetadataEditingTest(CourseTestCase): def test_update_from_json(self): test_model = CourseMetadata.update_from_json(self.course_location, - { "advertised_start" : "start A", - "testcenter_info" : { "c" : "test" }, - "days_early_for_beta" : 2}) + {"advertised_start": "start A", + "testcenter_info": {"c": "test"}, + "days_early_for_beta": 2}) self.update_check(test_model) # try fresh fetch to ensure persistence test_model = CourseMetadata.fetch(self.course_location) self.update_check(test_model) # now change some of the existing metadata test_model = CourseMetadata.update_from_json(self.course_location, - { "advertised_start" : "start B", - "display_name" : "jolly roger"}) + {"advertised_start": "start B", + "display_name": "jolly roger"}) self.assertIn('display_name', test_model, 'Missing editable metadata field') self.assertEqual(test_model['display_name'], 'jolly roger', "not expected value") self.assertIn('advertised_start', test_model, 'Missing revised advertised_start metadata field') @@ -294,13 +294,12 @@ class CourseMetadataEditingTest(CourseTestCase): self.assertIn('advertised_start', test_model, 'Missing new advertised_start metadata field') self.assertEqual(test_model['advertised_start'], 'start A', "advertised_start not expected value") self.assertIn('testcenter_info', test_model, 'Missing testcenter_info metadata field') - self.assertDictEqual(test_model['testcenter_info'], { "c" : "test" }, "testcenter_info not expected value") + self.assertDictEqual(test_model['testcenter_info'], {"c": "test"}, "testcenter_info not expected value") self.assertIn('days_early_for_beta', test_model, 'Missing days_early_for_beta metadata field') self.assertEqual(test_model['days_early_for_beta'], 2, "days_early_for_beta not expected value") - def test_delete_key(self): - test_model = CourseMetadata.delete_key(self.fullcourse_location, { 'deleteKeys' : ['doesnt_exist', 'showanswer', 'xqa_key']}) + test_model = CourseMetadata.delete_key(self.fullcourse_location, {'deleteKeys': ['doesnt_exist', 'showanswer', 'xqa_key']}) # ensure no harm self.assertNotIn('graceperiod', test_model, 'blacklisted field leaked in') self.assertIn('display_name', test_model, 'full missing editable metadata field') diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index bbaebfb687..6b1b6b7f6f 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -69,4 +69,5 @@ class UrlReverseTestCase(ModuleStoreTestCase): self.assertEquals( 'https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/about', utils.get_url_reverse('https://edge.edx.org/courses/edX/edX101/How_to_Create_an_edX_Course/about', course) - ) \ No newline at end of file + ) + \ No newline at end of file diff --git a/cms/djangoapps/contentstore/tests/tests.py b/cms/djangoapps/contentstore/tests/tests.py index e43a95fccd..72e30dca64 100644 --- a/cms/djangoapps/contentstore/tests/tests.py +++ b/cms/djangoapps/contentstore/tests/tests.py @@ -1,29 +1,6 @@ -import json -import shutil from django.test.client import Client -from django.conf import settings from django.core.urlresolvers import reverse -from path import path -import json -from fs.osfs import OSFS -import copy -from contentstore.utils import get_modulestore - -from xmodule.modulestore import Location -from xmodule.modulestore.store_utilities import clone_course -from xmodule.modulestore.store_utilities import delete_course -from xmodule.modulestore.django import modulestore, _MODULESTORES -from xmodule.contentstore.django import contentstore -from xmodule.templates import update_templates -from xmodule.modulestore.xml_exporter import export_to_xml -from xmodule.modulestore.xml_importer import import_from_xml - -from xmodule.capa_module import CapaDescriptor -from xmodule.course_module import CourseDescriptor -from xmodule.seq_module import SequenceDescriptor - -from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from .utils import ModuleStoreTestCase, parse_json, user, registration @@ -84,6 +61,7 @@ class ContentStoreTestCase(ModuleStoreTestCase): # Now make sure that the user is now actually activated self.assertTrue(user(email).is_active) + class AuthTestCase(ContentStoreTestCase): """Check that various permissions-related things work""" @@ -101,9 +79,9 @@ class AuthTestCase(ContentStoreTestCase): def test_public_pages_load(self): """Make sure pages that don't require login load without error.""" pages = ( - reverse('login'), - reverse('signup'), - ) + reverse('login'), + reverse('signup'), + ) for page in pages: print "Checking '{0}'".format(page) self.check_page_get(page, 200) @@ -136,13 +114,13 @@ class AuthTestCase(ContentStoreTestCase): """Make sure pages that do require login work.""" auth_pages = ( reverse('index'), - ) + ) # These are pages that should just load when the user is logged in # (no data needed) simple_auth_pages = ( reverse('index'), - ) + ) # need an activated user self.test_create_account() diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index b7af8047f6..603010f5b4 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -346,14 +346,14 @@ def edit_unit(request, location): 'preview.' + settings.LMS_BASE) preview_lms_link = '//{preview_lms_base}/courses/{org}/{course}/{course_name}/courseware/{section}/{subsection}/{index}'.format( - preview_lms_base=preview_lms_base, - lms_base=settings.LMS_BASE, - org=course.location.org, - course=course.location.course, - course_name=course.location.name, - section=containing_section.location.name, - subsection=containing_subsection.location.name, - index=index) + preview_lms_base=preview_lms_base, + lms_base=settings.LMS_BASE, + org=course.location.org, + course=course.location.course, + course_name=course.location.name, + section=containing_section.location.name, + subsection=containing_subsection.location.name, + index=index) unit_state = compute_unit_state(item) @@ -839,6 +839,7 @@ def upload_asset(request, org, course, coursename): response['asset_url'] = StaticContent.get_url_path_from_location(content.location) return response + @login_required @ensure_csrf_cookie def manage_users(request, location):