Merge pull request #3725 from carsongee/cg/transcript_xmlmodulestore_fix

Fix bug affecting video transcripts in XMLModulesStore courses
This commit is contained in:
Carson Gee
2014-05-15 08:50:36 -04:00
2 changed files with 48 additions and 3 deletions

View File

@@ -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)
)
)