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
a6035698
Commit
a6035698
authored
Jan 21, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly compute course image location when using mongo modulestore
[LMS-2073] [STUD-1197]
parent
923c2ff4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
6 deletions
+2
-6
cms/djangoapps/contentstore/tests/test_utils.py
+0
-2
cms/djangoapps/contentstore/utils.py
+1
-1
lms/djangoapps/courseware/courses.py
+1
-1
lms/djangoapps/courseware/tests/test_courses.py
+0
-2
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
a6035698
...
...
@@ -2,7 +2,6 @@
import
collections
import
copy
import
mock
from
unittest
import
expectedFailure
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
...
...
@@ -168,7 +167,6 @@ class CourseImageTestCase(TestCase):
url
=
utils
.
course_image_url
(
course
)
self
.
assertEquals
(
url
,
'/c4x/edX/999/asset/{0}'
.
format
(
course
.
course_image
))
@expectedFailure
def
test_non_ascii_image_name
(
self
):
# Verify that non-ascii image names are cleaned
course
=
CourseFactory
.
create
(
course_image
=
u'before_
\N{SNOWMAN}
_after.jpg'
)
...
...
cms/djangoapps/contentstore/utils.py
View file @
a6035698
...
...
@@ -191,7 +191,7 @@ def get_lms_link_for_about_page(location):
def
course_image_url
(
course
):
"""Returns the image url for the course."""
loc
=
course
.
location
.
_replace
(
tag
=
'c4x'
,
category
=
'asset'
,
name
=
course
.
course_image
)
loc
=
StaticContent
.
compute_location
(
course
.
location
.
org
,
course
.
location
.
course
,
course
.
course_image
)
path
=
StaticContent
.
get_url_path_from_location
(
loc
)
return
path
...
...
lms/djangoapps/courseware/courses.py
View file @
a6035698
...
...
@@ -106,7 +106,7 @@ def course_image_url(course):
if
course
.
static_asset_path
or
modulestore
()
.
get_modulestore_type
(
course
.
location
.
course_id
)
==
XML_MODULESTORE_TYPE
:
return
'/static/'
+
(
course
.
static_asset_path
or
getattr
(
course
,
'data_dir'
,
''
))
+
"/images/course_image.jpg"
else
:
loc
=
course
.
location
.
replace
(
tag
=
'c4x'
,
category
=
'asset'
,
name
=
course
.
course_image
)
loc
=
StaticContent
.
compute_location
(
course
.
location
.
org
,
course
.
location
.
course
,
course
.
course_image
)
_path
=
StaticContent
.
get_url_path_from_location
(
loc
)
return
_path
...
...
lms/djangoapps/courseware/tests/test_courses.py
View file @
a6035698
...
...
@@ -3,7 +3,6 @@
Tests for course access
"""
import
mock
from
unittest
import
expectedFailure
from
django.http
import
Http404
from
django.test.utils
import
override_settings
...
...
@@ -96,7 +95,6 @@ class MongoCourseImageTestCase(ModuleStoreTestCase):
course
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'999'
)
self
.
assertEquals
(
course_image_url
(
course
),
'/c4x/edX/999/asset/{0}'
.
format
(
course
.
course_image
))
@expectedFailure
def
test_non_ascii_image_name
(
self
):
# Verify that non-ascii image names are cleaned
course
=
CourseFactory
.
create
(
course_image
=
u'before_
\N{SNOWMAN}
_after.jpg'
)
...
...
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