Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d05b7a21
Commit
d05b7a21
authored
Oct 22, 2015
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10312 from edx/andya/dev-xblock-assets
Allow non-public XBlock assets in debug mode
parents
9cfbbb23
054aa95b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
22 deletions
+17
-22
cms/envs/common.py
+3
-0
cms/urls.py
+1
-1
lms/djangoapps/courseware/module_render.py
+0
-18
lms/envs/common.py
+3
-0
lms/urls.py
+1
-1
openedx/core/djangoapps/common_views/__init__.py
+0
-0
openedx/core/djangoapps/common_views/xblock.py
+9
-2
No files found.
cms/envs/common.py
View file @
d05b7a21
...
...
@@ -711,6 +711,9 @@ INSTALLED_APPS = (
'south'
,
'method_override'
,
# Common views
'openedx.core.djangoapps.common_views'
,
# History tables
'simple_history'
,
...
...
cms/urls.py
View file @
d05b7a21
...
...
@@ -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>[^/]+)$'
,
...
...
lms/djangoapps/courseware/module_render.py
View file @
d05b7a21
...
...
@@ -5,7 +5,6 @@ Module rendering
import
hashlib
import
json
import
logging
import
mimetypes
import
static_replace
...
...
@@ -946,23 +945,6 @@ def handle_xblock_callback(request, course_id, usage_id, handler, suffix=None):
return
_invoke_xblock_handler
(
request
,
course_id
,
usage_id
,
handler
,
suffix
,
course
=
course
)
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
)
def
get_module_by_usage_id
(
request
,
course_id
,
usage_id
,
disable_staff_debug_info
=
False
,
course
=
None
):
"""
Gets a module instance based on its `usage_id` in a course, for a given request/user
...
...
lms/envs/common.py
View file @
d05b7a21
...
...
@@ -1794,6 +1794,9 @@ INSTALLED_APPS = (
'djcelery'
,
'south'
,
# Common views
'openedx.core.djangoapps.common_views'
,
# History tables
'simple_history'
,
...
...
lms/urls.py
View file @
d05b7a21
...
...
@@ -307,7 +307,7 @@ if settings.COURSEWARE_ENABLED:
# xblock Resource URL
url
(
r'xblock/resource/(?P<block_type>[^/]+)/(?P<uri>.*)$'
,
'
courseware.module_render
.xblock_resource'
,
'
openedx.core.djangoapps.common_views.xblock
.xblock_resource'
,
name
=
'xblock_resource_url'
,
),
...
...
openedx/core/djangoapps/common_views/__init__.py
0 → 100644
View file @
d05b7a21
cms/djangoapps/contentstore/
views/xblock.py
→
openedx/core/djangoapps/common_
views/xblock.py
View file @
d05b7a21
"""
V
iews dedicated to rendering xblocks.
Common v
iews dedicated to rendering xblocks.
"""
from
__future__
import
absolute_import
import
logging
import
mimetypes
import
pkg_resources
from
xblock.core
import
XBlock
...
...
@@ -21,7 +22,13 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen
"""
try
:
xblock_class
=
XBlock
.
load_class
(
block_type
,
select
=
settings
.
XBLOCK_SELECT_FUNCTION
)
content
=
xblock_class
.
open_local_resource
(
uri
)
# Note: in debug mode, return any file rather than going through the XBlock which
# will only return public files. This allows unbundled files to be served up
# during development.
if
settings
.
DEBUG
:
content
=
pkg_resources
.
resource_stream
(
xblock_class
.
__module__
,
uri
)
else
:
content
=
xblock_class
.
open_local_resource
(
uri
)
except
IOError
:
log
.
info
(
'Failed to load xblock resource'
,
exc_info
=
True
)
raise
Http404
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment