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
52d8317a
Commit
52d8317a
authored
May 14, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug affecting video transcripts in XMLModulesStore courses
parent
df3d6e3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
3 deletions
+48
-3
common/lib/xmodule/xmodule/video_module/video_handlers.py
+12
-3
lms/djangoapps/courseware/tests/test_video_handlers.py
+36
-0
No files found.
common/lib/xmodule/xmodule/video_module/video_handlers.py
View file @
52d8317a
...
...
@@ -195,12 +195,21 @@ class VideoStudentViewHandlers(object):
if
transcript_name
:
course_location
=
CourseDescriptor
.
id_to_location
(
self
.
course_id
)
course
=
self
.
descriptor
.
runtime
.
modulestore
.
get_item
(
course_location
)
if
course
.
static_asset_path
:
# Get the asset path for course
asset_path
=
None
if
hasattr
(
self
.
descriptor
.
runtime
,
'modulestore'
):
course
=
self
.
descriptor
.
runtime
.
modulestore
.
get_item
(
course_location
)
asset_path
=
course
.
static_asset_path
else
:
# Handle XML Courses that don't have modulestore in the runtime
asset_path
=
getattr
(
self
.
descriptor
,
'data_dir'
,
None
)
if
asset_path
:
response
=
Response
(
status
=
307
,
location
=
'/static/{0}/{1}'
.
format
(
course
.
static_
asset_path
,
asset_path
,
subs_filename
(
transcript_name
,
self
.
transcript_language
)
)
)
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
52d8317a
...
...
@@ -439,6 +439,42 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/uk'
)
self
.
assertEqual
(
response
.
status
,
'404 Not Found'
)
def
test_xml_transcript
(
self
):
"""
Set data_dir and remove runtime modulestore to simulate an XMLModuelStore course.
Then run the same tests as static_asset_path run.
"""
# Simulate XMLModuleStore xmodule
self
.
item_descriptor
.
data_dir
=
'dummy/static'
del
self
.
item_descriptor
.
runtime
.
modulestore
self
.
assertFalse
(
self
.
course
.
static_asset_path
)
# Test youtube style en
request
=
Request
.
blank
(
'/translation/en?videoId=12345'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/en'
)
self
.
assertEqual
(
response
.
status
,
'307 Temporary Redirect'
)
self
.
assertIn
(
(
'Location'
,
'/static/dummy/static/subs_12345.srt.sjson'
),
response
.
headerlist
)
# Test HTML5 video style
self
.
item
.
sub
=
'OEoXaMPEzfM'
request
=
Request
.
blank
(
'/translation/en'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/en'
)
self
.
assertEqual
(
response
.
status
,
'307 Temporary Redirect'
)
self
.
assertIn
(
(
'Location'
,
'/static/dummy/static/subs_OEoXaMPEzfM.srt.sjson'
),
response
.
headerlist
)
# Test different language to ensure we are just ignoring it since we can't
# translate with static fallback
request
=
Request
.
blank
(
'/translation/uk'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/uk'
)
self
.
assertEqual
(
response
.
status
,
'404 Not Found'
)
class
TestStudioTranscriptTranslationGetDispatch
(
TestVideo
):
"""
...
...
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