From 0964bf280f9704a2439769395faaf19d1cc38ebd Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Wed, 7 Oct 2015 14:10:29 -0400 Subject: [PATCH] Remove unused method subsection_handler Removing this particular call to json.dumps was done by removing the complete method subsection_handler which is no longer used. The template edit_subsection.html had already been removed. TNL-2646 Escape json --- .../contentstore/views/component.py | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index 994af7c1db..b85900efdc 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -74,66 +74,6 @@ def _advanced_component_types(): return [c_type for c_type in ADVANCED_COMPONENT_TYPES if c_type not in settings.DEPRECATED_ADVANCED_COMPONENT_TYPES] -@require_GET -@login_required -def subsection_handler(request, usage_key_string): - """ - The restful handler for subsection-specific requests. - - GET - html: return html page for editing a subsection - json: not currently supported - """ - if 'text/html' in request.META.get('HTTP_ACCEPT', 'text/html'): - usage_key = UsageKey.from_string(usage_key_string) - try: - course, item, lms_link, preview_link = _get_item_in_course(request, usage_key) - except ItemNotFoundError: - return HttpResponseBadRequest() - - # make sure that location references a 'sequential', otherwise return - # BadRequest - if item.location.category != 'sequential': - return HttpResponseBadRequest() - - parent = get_parent_xblock(item) - - # remove all metadata from the generic dictionary that is presented in a - # more normalized UI. We only want to display the XBlocks fields, not - # the fields from any mixins that have been added - fields = getattr(item, 'unmixed_class', item.__class__).fields - - policy_metadata = dict( - (field.name, field.read_from(item)) - for field - in fields.values() - if field.name not in ['display_name', 'start', 'due', 'format'] and field.scope == Scope.settings - ) - - can_view_live = False - subsection_units = item.get_children() - can_view_live = any([modulestore().has_published_version(unit) for unit in subsection_units]) - - return render_to_response( - 'edit_subsection.html', - { - 'subsection': item, - 'context_course': course, - 'new_unit_category': 'vertical', - 'lms_link': lms_link, - 'preview_link': preview_link, - 'course_graders': json.dumps(CourseGradingModel.fetch(item.location.course_key).graders), - 'parent_item': parent, - 'locator': item.location, - 'policy_metadata': policy_metadata, - 'subsection_units': subsection_units, - 'can_view_live': can_view_live - } - ) - else: - return HttpResponseBadRequest("Only supports html requests") - - def _load_mixed_class(category): """ Load an XBlock by category name, and apply all defined mixins