Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions common/lib/xmodule/xmodule/course_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@ def __init__(self, *args, **kwargs):
log.error(msg)
continue

# TODO check that this is still needed here and can't be by defaults.
if self.tabs is None:
if not self.tabs:
# When calling the various _tab methods, can omit the 'type':'blah' from the
# first arg, since that's only used for dispatch
tabs = []
Expand Down
6 changes: 1 addition & 5 deletions common/lib/xmodule/xmodule/video_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def from_xml(cls, xml_data, system, org=None, course=None):
url identifiers
"""
video = super(VideoDescriptor, cls).from_xml(xml_data, system, org, course)
_parse_video_xml(video, xml_data)
_parse_video_xml(video, video.data)
return video

def definition_to_xml(self, resource_fs):
Expand All @@ -146,10 +146,6 @@ def _parse_video_xml(video, xml_data):
display_name = xml.get('display_name')
if display_name:
video.display_name = display_name
elif video.url_name is not None:
# copies the logic of display_name_with_default in order that studio created videos will have an
# initial non guid name
video.display_name = video.url_name.replace('_', ' ')

youtube = xml.get('youtube')
if youtube:
Expand Down
4 changes: 3 additions & 1 deletion common/lib/xmodule/xmodule/xml_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ def from_xml(cls, xml_data, system, org=None, course=None):
org and course are optional strings that will be used in the generated modules
url identifiers
"""

xml_object = etree.fromstring(xml_data)
# VS[compat] -- just have the url_name lookup, once translation is done
url_name = xml_object.get('url_name', xml_object.get('slug'))
Expand All @@ -318,7 +319,8 @@ def from_xml(cls, xml_data, system, org=None, course=None):
filepath = cls._format_filepath(xml_object.tag, name_to_pathname(url_name))
definition_xml = cls.load_file(filepath, system.resources_fs, location)
else:
definition_xml = xml_object # this is just a pointer, not the real definition content
definition_xml = xml_object
filepath = None

definition, children = cls.load_definition(definition_xml, system, location) # note this removes metadata

Expand Down
2 changes: 1 addition & 1 deletion common/test/data/toy/chapter/secret/magic.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<chapter>
<video url_name="toyvideo" youtube_id_1_0="OEoXaMPEzfM"/>
<video url_name="toyvideo" youtube_id_1_0="OEoXaMPEzfM" display_name="toyvideo"/>
</chapter>
6 changes: 3 additions & 3 deletions common/test/data/toy/course/2012_Fall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<chapter url_name="Overview">
<videosequence url_name="Toy_Videos">
<html url_name="secret:toylab"/>
<video url_name="Video_Resources" youtube_id_1_0="1bK-WdDi6Qw"/>
<video url_name="Video_Resources" youtube_id_1_0="1bK-WdDi6Qw" display_name="Video Resources"/>
</videosequence>
<video url_name="Welcome" youtube_id_1_0="p2Q6BrNhdh8"/>
<video url_name="video_123456789012" youtube_id_1_0="p2Q6BrNhdh8"/>
<video url_name="Welcome" youtube_id_1_0="p2Q6BrNhdh8" display_name="Welcome"/>
<video url_name="video_123456789012" youtube_id_1_0="p2Q6BrNhdh8" display_name='Test Video'/>
<video url_name="video_4f66f493ac8f" youtube_id_1_0="p2Q6BrNhdh8"/>
</chapter>
<chapter url_name="secret:magic"/>
Expand Down
2 changes: 2 additions & 0 deletions common/test/data/toy/vertical/vertical_test.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<sequential>
<video display_name="default" youtube_id_0_75="JMD_ifUUfsU" youtube_id_1_0="OEoXaMPEzfM" youtube_id_1_25="AKqURZnYqpk" youtube_id_1_5="DYpADpL7jAY" name="sample_video"/>
<video url_name="separate_file_video"/>
<poll_question name="T1_changemind_poll_foo_2" display_name="Change your answer" reset="false">
<p>Have you changed your mind?</p>
<answer id="yes">Yes</answer>
Expand Down
1 change: 1 addition & 0 deletions common/test/data/toy/video/separate_file_video.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<video display_name="default" youtube_id_0_75="JMD_ifUUfsU" youtube_id_1_0="OEoXaMPEzfM" youtube_id_1_25="AKqURZnYqpk" youtube_id_1_5="DYpADpL7jAY" name="sample_video"/>
9 changes: 5 additions & 4 deletions lms/djangoapps/courseware/tests/test_module_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def test_toc_toy_from_chapter(self):
'format': u'Lecture Sequence', 'due': None, 'active': False},
{'url_name': 'Welcome', 'display_name': u'Welcome', 'graded': True,
'format': '', 'due': None, 'active': False},
{'url_name': 'video_123456789012', 'display_name': 'video 123456789012', 'graded': True,
{'url_name': 'video_123456789012', 'display_name': 'Test Video', 'graded': True,
'format': '', 'due': None, 'active': False},
{'url_name': 'video_4f66f493ac8f', 'display_name': 'video 4f66f493ac8f', 'graded': True,
{'url_name': 'video_4f66f493ac8f', 'display_name': 'Video Title', 'graded': True,
'format': '', 'due': None, 'active': False}],
'url_name': 'Overview', 'display_name': u'Overview'},
{'active': False, 'sections':
Expand All @@ -199,6 +199,7 @@ def test_toc_toy_from_chapter(self):
'url_name': 'secret:magic', 'display_name': 'secret:magic'}])

actual = render.toc_for_course(self.portal_user, request, self.toy_course, chapter, None, model_data_cache)
print actual
assert reduce(lambda x, y: x and (y in actual), expected, True)

def test_toc_toy_from_section(self):
Expand All @@ -215,9 +216,9 @@ def test_toc_toy_from_section(self):
'format': u'Lecture Sequence', 'due': None, 'active': False},
{'url_name': 'Welcome', 'display_name': u'Welcome', 'graded': True,
'format': '', 'due': None, 'active': True},
{'url_name': 'video_123456789012', 'display_name': 'video 123456789012', 'graded': True,
{'url_name': 'video_123456789012', 'display_name': 'Test Video', 'graded': True,
'format': '', 'due': None, 'active': False},
{'url_name': 'video_4f66f493ac8f', 'display_name': 'video 4f66f493ac8f', 'graded': True,
{'url_name': 'video_4f66f493ac8f', 'display_name': 'Video Title', 'graded': True,
'format': '', 'due': None, 'active': False}],
'url_name': 'Overview', 'display_name': u'Overview'},
{'active': False, 'sections':
Expand Down