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
2b576034
Commit
2b576034
authored
Aug 07, 2015
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle case of video in a content library with no transcripts.
This partially addresses TNL-1776
parent
e09f9ac4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
common/lib/xmodule/xmodule/video_module/video_handlers.py
+5
-0
lms/djangoapps/courseware/tests/test_video_handlers.py
+22
-5
No files found.
common/lib/xmodule/xmodule/video_module/video_handlers.py
View file @
2b576034
...
...
@@ -14,6 +14,7 @@ from xblock.core import XBlock
from
xmodule.exceptions
import
NotFoundError
from
xmodule.fields
import
RelativeTime
from
opaque_keys.edx.locator
import
CourseLocator
from
.transcripts_utils
import
(
get_or_create_sjson
,
...
...
@@ -166,6 +167,10 @@ class VideoStudentViewHandlers(object):
if
not
self
.
transcript_language
==
'en'
:
return
response
# If this video lives in library, the code below is not relevant and will error.
if
not
isinstance
(
self
.
course_id
,
CourseLocator
):
return
response
video_id
=
request
.
GET
.
get
(
'videoId'
,
None
)
if
video_id
:
transcript_name
=
video_id
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
2b576034
...
...
@@ -569,11 +569,7 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
Set course static_asset_path and ensure we get redirected to that path
if it isn't found in the contentstore
"""
self
.
course
.
static_asset_path
=
'dummy/static'
self
.
course
.
save
()
store
=
modulestore
()
with
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
self
.
course
.
id
):
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
self
.
_set_static_asset_path
()
if
attach
:
attach
(
self
.
item
,
sub
)
...
...
@@ -586,6 +582,27 @@ class TestTranscriptTranslationGetDispatch(TestVideo):
response
.
headerlist
)
@patch
(
'xmodule.video_module.VideoModule.course_id'
,
return_value
=
'not_a_course_locator'
)
def
test_translation_static_non_course
(
self
,
__
):
"""
Test that get_static_transcript short-circuits in the case of a non-CourseLocator.
This fixes a bug for videos inside of content libraries.
"""
self
.
_set_static_asset_path
()
# When course_id is not mocked out, these values would result in 307, as tested above.
request
=
Request
.
blank
(
'/translation/en?videoId=12345'
)
response
=
self
.
item
.
transcript
(
request
=
request
,
dispatch
=
'translation/en'
)
self
.
assertEqual
(
response
.
status
,
'404 Not Found'
)
def
_set_static_asset_path
(
self
):
""" Helper method for setting up the static_asset_path information """
self
.
course
.
static_asset_path
=
'dummy/static'
self
.
course
.
save
()
store
=
modulestore
()
with
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
self
.
course
.
id
):
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
@attr
(
'shard_1'
)
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