Skip to content
Snippets Groups Projects
Commit 40611acf authored by DawoudSheraz's avatar DawoudSheraz
Browse files

render content and log the error when getting sibling urls

parent 6d2ed9d8
No related branches found
No related tags found
No related merge requests found
......@@ -550,7 +550,7 @@ def get_sibling_urls(subsection):
# section.get_parent SHOULD return the course, but for some reason, it might not
sections = section.get_parent().get_children()
except AttributeError:
log.error(u"Error retrieving URLs in subsection {subsection} included in section {section}".format(
log.error(u"URL Retrieval Error # 1: subsection {subsection} included in section {section}".format(
section=section.location,
subsection=subsection.location
))
......@@ -563,12 +563,19 @@ def get_sibling_urls(subsection):
except IndexError:
pass
if not next_loc:
sections = section.get_parent().get_children()
try:
next_section = sections[sections.index(section) + 1]
next_loc = next_section.get_children()[0].get_children()[0].location
except IndexError:
pass
sections = section.get_parent().get_children()
except AttributeError:
log.error(u"URL Retrieval Error # 2: subsection {subsection} included in section {section}".format(
section=section.location,
subsection=subsection.location
))
else:
try:
next_section = sections[sections.index(section) + 1]
next_loc = next_section.get_children()[0].get_children()[0].location
except IndexError:
pass
if prev_loc:
prev_url = reverse_usage_url('container_handler', prev_loc)
if next_loc:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment