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
ccb776e9
Commit
ccb776e9
authored
Mar 03, 2014
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch exception if for en no default subs is uploaded.
parent
93607603
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletions
+15
-1
common/lib/xmodule/xmodule/video_module/video_module.py
+4
-1
lms/djangoapps/courseware/tests/test_video_handlers.py
+11
-0
No files found.
common/lib/xmodule/xmodule/video_module/video_module.py
View file @
ccb776e9
...
...
@@ -342,7 +342,7 @@ class VideoModule(VideoFields, XModule):
try
:
transcript
=
self
.
translation
(
request
.
GET
.
get
(
'videoId'
))
except
TranscriptException
as
ex
:
except
(
TranscriptException
,
NotFoundError
)
as
ex
:
log
.
info
(
ex
.
message
)
response
=
Response
(
status
=
404
)
else
:
...
...
@@ -414,6 +414,9 @@ class VideoModule(VideoFields, XModule):
Filenames naming:
en: subs_videoid.srt.sjson
non_en: uk_subs_videoid.srt.sjson
Raises:
NotFoundError if for 'en' subtitles no asset is uploaded.
"""
if
self
.
transcript_language
==
'en'
:
return
asset
(
self
.
location
,
subs_id
)
.
data
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
ccb776e9
...
...
@@ -161,6 +161,8 @@ class TestVideoTranscriptTranslation(TestVideo):
self
.
item_descriptor
.
render
(
'student_view'
)
self
.
item
=
self
.
item_descriptor
.
xmodule_runtime
.
xmodule_instance
# Tests for `download` dispatch:
def
test_language_is_not_supported
(
self
):
request
=
Request
.
blank
(
'/download?language=ru'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'download'
)
...
...
@@ -177,6 +179,15 @@ class TestVideoTranscriptTranslation(TestVideo):
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'download'
)
self
.
assertEqual
(
response
.
body
,
'Subs!'
)
def
test_download_en_no_sub
(
self
):
request
=
Request
.
blank
(
'/download?language=en'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'download'
)
self
.
assertEqual
(
response
.
status
,
'404 Not Found'
)
with
self
.
assertRaises
(
NotFoundError
):
self
.
item
.
get_transcript
()
# Tests for `translation` dispatch:
def
test_translation_fails
(
self
):
# No videoId
request
=
Request
.
blank
(
'/translation?language=ru'
)
...
...
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