Allow non-public XBlock assets in debug mode
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
"""
|
||||
Views dedicated to rendering xblocks.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
import mimetypes
|
||||
|
||||
from xblock.core import XBlock
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import Http404, HttpResponse
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def xblock_resource(request, block_type, uri): # pylint: disable=unused-argument
|
||||
"""
|
||||
Return a package resource for the specified XBlock.
|
||||
"""
|
||||
try:
|
||||
xblock_class = XBlock.load_class(block_type, select=settings.XBLOCK_SELECT_FUNCTION)
|
||||
content = xblock_class.open_local_resource(uri)
|
||||
except IOError:
|
||||
log.info('Failed to load xblock resource', exc_info=True)
|
||||
raise Http404
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error('Failed to load xblock resource', exc_info=True)
|
||||
raise Http404
|
||||
|
||||
mimetype, _ = mimetypes.guess_type(uri)
|
||||
return HttpResponse(content, mimetype=mimetype)
|
||||
@@ -711,6 +711,9 @@ INSTALLED_APPS = (
|
||||
'south',
|
||||
'method_override',
|
||||
|
||||
# Common views
|
||||
'openedx.core.djangoapps.common_views',
|
||||
|
||||
# History tables
|
||||
'simple_history',
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ urlpatterns = patterns(
|
||||
'contentstore.views.component_handler', name='component_handler'),
|
||||
|
||||
url(r'^xblock/resource/(?P<block_type>[^/]*)/(?P<uri>.*)$',
|
||||
'contentstore.views.xblock.xblock_resource', name='xblock_resource_url'),
|
||||
'openedx.core.djangoapps.common_views.xblock.xblock_resource', name='xblock_resource_url'),
|
||||
|
||||
# temporary landing page for a course
|
||||
url(r'^edge/(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)$',
|
||||
|
||||
Reference in New Issue
Block a user