Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 491aca8

Browse files
committed
Fix: catch missing ids
1 parent 16b0bea commit 491aca8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

runestone/pretext/chapter_pop.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,18 @@ def manifest_data_to_db(course_name, manifest_path):
155155
el = question.find(".//*[@data-component]")
156156
# Unbelievably if find finds something it evals to False!!
157157
if el is not None:
158-
idchild = el.attrib["id"]
158+
if "id" in el.attrib:
159+
idchild = el.attrib["id"]
160+
else:
161+
idchild = "fix_me"
159162
else:
160163
el = question.find("./div")
161-
idchild = el.attrib["id"] or "foo_id"
164+
if el is None:
165+
idchild = "fix_me"
166+
elif "id" in el.attrib:
167+
idchild = el.attrib["id"]
168+
else:
169+
idchild = "fix_me"
162170
try:
163171
qtype = el.attrib["data-component"]
164172
# translate qtype to question_type

0 commit comments

Comments
 (0)