diff --git a/cms/djangoapps/contentstore/views/access.py b/cms/djangoapps/contentstore/views/access.py index 803313e274..49ce0c8733 100644 --- a/cms/djangoapps/contentstore/views/access.py +++ b/cms/djangoapps/contentstore/views/access.py @@ -2,12 +2,13 @@ from auth.authz import STAFF_ROLE_NAME, INSTRUCTOR_ROLE_NAME from auth.authz import is_user_in_course_group_role from django.core.exceptions import PermissionDenied from ..utils import get_course_location_for_item +from xmodule.modulestore import Location def get_location_and_verify_access(request, org, course, name): """ - Create the location tuple verify that the user has permissions - to view the location. Returns the location. + Create the location, verify that the user has permissions + to view the location. Returns the location as a Location """ location = ['i4x', org, course, 'course', name] @@ -15,7 +16,7 @@ def get_location_and_verify_access(request, org, course, name): if not has_access(request.user, location): raise PermissionDenied() - return location + return Location(location) def has_access(user, location, role=STAFF_ROLE_NAME): diff --git a/cms/djangoapps/contentstore/views/assets.py b/cms/djangoapps/contentstore/views/assets.py index 41077abd8f..c85570fede 100644 --- a/cms/djangoapps/contentstore/views/assets.py +++ b/cms/djangoapps/contentstore/views/assets.py @@ -258,7 +258,7 @@ def import_course(request, org, course, name): _module_store, course_items = import_from_xml(modulestore('direct'), settings.GITHUB_REPO_ROOT, [course_subdir], load_error_modules=False, static_content_store=contentstore(), - target_location_namespace=Location(location), + target_location_namespace=location, draft_store=modulestore()) # we can blow this away when we're done importing. diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 8862115c45..d790697612 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -153,7 +153,7 @@ def course_info(request, org, course, name, provided_id=None): course_module = modulestore().get_item(location) # get current updates - location = ['i4x', org, course, 'course_info', "updates"] + location = Location(['i4x', org, course, 'course_info', "updates"]) return render_to_response('course_info.html', { 'active_tab': 'courseinfo-tab', diff --git a/cms/djangoapps/models/settings/course_details.py b/cms/djangoapps/models/settings/course_details.py index 884a4e4fef..8ce8c2db34 100644 --- a/cms/djangoapps/models/settings/course_details.py +++ b/cms/djangoapps/models/settings/course_details.py @@ -74,7 +74,7 @@ class CourseDetails(object): Decode the json into CourseDetails and save any changed attrs to the db """ # TODO make it an error for this to be undefined & for it to not be retrievable from modulestore - course_location = jsondict['course_location'] + course_location = Location(jsondict['course_location']) # Will probably want to cache the inflight courses because every blur generates an update descriptor = get_modulestore(course_location).get_item(course_location)