def get_module_context(course, item):
 item_dict = {'location': unicode(item.location), 'display_name': item.display_name_with_default_escaped}
 if ((item.category == 'chapter') and item.get_parent()):
  course = item.get_parent()
  item_dict['index'] = get_index(item_dict['location'], course.children)
 elif (item.category == 'vertical'):
  section = item.get_parent()
  chapter = section.get_parent()
  position = (get_index(unicode(item.location), section.children) + 1)
  item_dict['url'] = reverse('courseware_position', kwargs={'course_id': unicode(course.id), 'chapter': chapter.url_name, 'section': section.url_name, 'position': position})
 if (item.category in ('chapter', 'sequential')):
  item_dict['children'] = [unicode(child) for child in item.children]
 return item_dict

def get_module_context ( course , item ) : item_dict = { 'location' : unicode ( item . location ) , 'display_name' : item . display_name_with_default_escaped } if ( ( item . category == 'chapter' ) and item . get_parent ( ) ) : course = item . get_parent ( ) item_dict [ 'index' ] = get_index ( item_dict [ 'location' ] , course . children ) elif ( item . category == 'vertical' ) : section = item . get_parent ( ) chapter = section . get_parent ( ) position = ( get_index ( unicode ( item . location ) , section . children ) + 1 ) item_dict [ 'url' ] = reverse ( 'courseware_position' , kwargs = { 'course_id' : unicode ( course . id ) , 'chapter' : chapter . url_name , 'section' : section . url_name , 'position' : position } ) if ( item . category in ( 'chapter' , 'sequential' ) ) : item_dict [ 'children' ] = [ unicode ( child ) for child in item . children ] return item_dict
returns dispay_name and url for the parent module .