Commit 2348ed3d by Vasyl Nakvasiuk

fix empty display_name problem

parent aa34c9d3
...@@ -17,6 +17,7 @@ log = logging.getLogger(__name__) ...@@ -17,6 +17,7 @@ log = logging.getLogger(__name__)
# OBSOLETE: This obsoletes 'type' # OBSOLETE: This obsoletes 'type'
class_priority = ['video', 'problem'] class_priority = ['video', 'problem']
def display_name(module): def display_name(module):
if hasattr(module, 'display_name'): if hasattr(module, 'display_name'):
return module.display_name return module.display_name
...@@ -24,6 +25,7 @@ def display_name(module): ...@@ -24,6 +25,7 @@ def display_name(module):
if hasattr(module, 'lms'): if hasattr(module, 'lms'):
return module.lms.display_name return module.lms.display_name
class SequenceModule(XModule): class SequenceModule(XModule):
''' Layout module which lays out content in a temporal sequence ''' Layout module which lays out content in a temporal sequence
''' '''
...@@ -84,14 +86,14 @@ class SequenceModule(XModule): ...@@ -84,14 +86,14 @@ class SequenceModule(XModule):
'title': "\n".join( 'title': "\n".join(
display_name(grand_child) display_name(grand_child)
for grand_child in child.get_children() for grand_child in child.get_children()
if display_name(grand_child) is not None if display_name(grand_child)
), ),
'progress_status': Progress.to_js_status_str(progress), 'progress_status': Progress.to_js_status_str(progress),
'progress_detail': Progress.to_js_detail_str(progress), 'progress_detail': Progress.to_js_detail_str(progress),
'type': child.get_icon_class(), 'type': child.get_icon_class(),
'id': child.id, 'id': child.id,
} }
if childinfo['title']=='': if childinfo['title'] == '':
childinfo['title'] = display_name(child) childinfo['title'] = display_name(child)
contents.append(childinfo) contents.append(childinfo)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment