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
5fbda0c6
Commit
5fbda0c6
authored
Oct 25, 2013
by
dcadams
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1396 from edx/dcadams/fix_static_paths
Fix for static path parsing
parents
dc589f72
20f1feb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
common/djangoapps/static_replace/test/test_static_replace.py
+14
-0
common/lib/xmodule/xmodule/contentstore/content.py
+9
-2
No files found.
common/djangoapps/static_replace/test/test_static_replace.py
View file @
5fbda0c6
...
@@ -90,6 +90,20 @@ def test_raw_static_check():
...
@@ -90,6 +90,20 @@ def test_raw_static_check():
assert_equals
(
path
,
replace_static_urls
(
path
,
text
))
assert_equals
(
path
,
replace_static_urls
(
path
,
text
))
@patch
(
'static_replace.staticfiles_storage'
)
@patch
(
'static_replace.modulestore'
)
def
test_static_url_with_query
(
mock_modulestore
,
mock_storage
):
"""
Make sure urls with query have the parameter section unaltered
"""
mock_storage
.
exists
.
return_value
=
False
mock_modulestore
.
return_value
=
Mock
(
MongoModuleStore
)
pre_text
=
'EMBED src ="/static/LAlec04_controller.swf?csConfigFile=/c4x/org/course/asset/LAlec04_config.xml"'
post_text
=
'EMBED src ="/c4x/org/course/asset/LAlec04_controller.swf?csConfigFile=/c4x/org/course/asset/LAlec04_config.xml"'
assert_equals
(
post_text
,
replace_static_urls
(
pre_text
,
DATA_DIRECTORY
,
COURSE_ID
))
def
test_regex
():
def
test_regex
():
yes
=
(
'"/static/foo.png"'
,
yes
=
(
'"/static/foo.png"'
,
'"/static/foo.png"'
,
'"/static/foo.png"'
,
...
...
common/lib/xmodule/xmodule/contentstore/content.py
View file @
5fbda0c6
...
@@ -6,6 +6,7 @@ XASSET_THUMBNAIL_TAIL_NAME = '.jpg'
...
@@ -6,6 +6,7 @@ XASSET_THUMBNAIL_TAIL_NAME = '.jpg'
import
os
import
os
import
logging
import
logging
import
StringIO
import
StringIO
from
urlparse
import
urlparse
,
urlunparse
from
xmodule.modulestore
import
Location
from
xmodule.modulestore
import
Location
from
.django
import
contentstore
from
.django
import
contentstore
...
@@ -125,8 +126,14 @@ class StaticContent(object):
...
@@ -125,8 +126,14 @@ class StaticContent(object):
a course_id
a course_id
"""
"""
org
,
course_num
,
__
=
course_id
.
split
(
"/"
)
org
,
course_num
,
__
=
course_id
.
split
(
"/"
)
loc
=
StaticContent
.
compute_location
(
org
,
course_num
,
path
)
return
StaticContent
.
get_url_path_from_location
(
loc
)
# Generate url of urlparse.path component
scheme
,
netloc
,
orig_path
,
params
,
query
,
fragment
=
urlparse
(
path
)
loc
=
StaticContent
.
compute_location
(
org
,
course_num
,
orig_path
)
loc_url
=
StaticContent
.
get_url_path_from_location
(
loc
)
# Reconstruct with new path
return
urlunparse
((
scheme
,
netloc
,
loc_url
,
params
,
query
,
fragment
))
def
stream_data
(
self
):
def
stream_data
(
self
):
yield
self
.
_data
yield
self
.
_data
...
...
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