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
f247adc4
Commit
f247adc4
authored
May 12, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from edx/ned/tweaks-for-pr-3464
Simple fixes
parents
ff156438
2f7adda0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
16 deletions
+23
-16
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
+18
-12
lms/djangoapps/courseware/courses.py
+5
-4
No files found.
common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
View file @
f247adc4
...
...
@@ -326,10 +326,12 @@ class TestMongoModuleStore(object):
self
.
content_store
.
find
(
location
)
root_dir
=
path
(
mkdtemp
())
export_to_xml
(
self
.
store
,
self
.
content_store
,
course_location
,
root_dir
,
'test_export'
)
assert_true
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
assert_true
(
path
(
root_dir
/
'test_export/static/images_course_image.jpg'
)
.
isfile
())
shutil
.
rmtree
(
root_dir
)
try
:
export_to_xml
(
self
.
store
,
self
.
content_store
,
course_location
,
root_dir
,
'test_export'
)
assert_true
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
assert_true
(
path
(
root_dir
/
'test_export/static/images_course_image.jpg'
)
.
isfile
())
finally
:
shutil
.
rmtree
(
root_dir
)
def
test_export_course_image_nondefault
(
self
):
"""
...
...
@@ -340,10 +342,12 @@ class TestMongoModuleStore(object):
assert_true
(
course
.
course_image
,
'just_a_test.jpg'
)
root_dir
=
path
(
mkdtemp
())
export_to_xml
(
self
.
store
,
self
.
content_store
,
course
.
location
,
root_dir
,
'test_export'
)
assert_true
(
path
(
root_dir
/
'test_export/static/just_a_test.jpg'
)
.
isfile
())
assert_false
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
shutil
.
rmtree
(
root_dir
)
try
:
export_to_xml
(
self
.
store
,
self
.
content_store
,
course
.
location
,
root_dir
,
'test_export'
)
assert_true
(
path
(
root_dir
/
'test_export/static/just_a_test.jpg'
)
.
isfile
())
assert_false
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
finally
:
shutil
.
rmtree
(
root_dir
)
def
test_course_without_image
(
self
):
"""
...
...
@@ -352,10 +356,12 @@ class TestMongoModuleStore(object):
"""
course
=
self
.
get_course_by_id
(
'edX/simple_with_draft/2012_Fall'
)
root_dir
=
path
(
mkdtemp
())
export_to_xml
(
self
.
store
,
self
.
content_store
,
course
.
location
,
root_dir
,
'test_export'
)
assert_false
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
assert_false
(
path
(
root_dir
/
'test_export/static/images_course_image.jpg'
)
.
isfile
())
shutil
.
rmtree
(
root_dir
)
try
:
export_to_xml
(
self
.
store
,
self
.
content_store
,
course
.
location
,
root_dir
,
'test_export'
)
assert_false
(
path
(
root_dir
/
'test_export/static/images/course_image.jpg'
)
.
isfile
())
assert_false
(
path
(
root_dir
/
'test_export/static/images_course_image.jpg'
)
.
isfile
())
finally
:
shutil
.
rmtree
(
root_dir
)
...
...
lms/djangoapps/courseware/courses.py
View file @
f247adc4
...
...
@@ -110,14 +110,15 @@ def course_image_url(course):
# set different than the default, return that path so that
# courses can use custom course image paths, otherwise just
# return the default static path.
url
=
'/static/'
+
(
course
.
static_asset_path
or
getattr
(
course
,
'data_dir'
,
''
))
if
hasattr
(
course
,
'course_image'
)
and
course
.
course_image
!=
course
.
fields
[
'course_image'
]
.
default
:
return
'/static/'
+
(
course
.
static_asset_path
or
getattr
(
course
,
'data_dir'
,
''
))
+
'/'
+
course
.
course_image
url
+=
'/'
+
course
.
course_image
else
:
return
'/static/'
+
(
course
.
static_asset_path
or
getattr
(
course
,
'data_dir'
,
''
))
+
"/images/course_image.jpg"
url
+=
'/images/course_image.jpg'
else
:
loc
=
StaticContent
.
compute_location
(
course
.
location
.
org
,
course
.
location
.
course
,
course
.
course_image
)
_path
=
StaticContent
.
get_url_path_from_location
(
loc
)
return
_path
url
=
StaticContent
.
get_url_path_from_location
(
loc
)
return
url
def
find_file
(
filesystem
,
dirs
,
filename
):
...
...
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