1010from sphinx .util import logging
1111
1212logger = logging .getLogger (__name__ )
13- #logger.setLevel(logging.INFO)
13+ # logger.setLevel(logging.INFO)
1414
1515QT_MAP = {
1616 "multiplechoice" : "mchoice" ,
@@ -71,8 +71,9 @@ def manifest_data_to_db(course_name, manifest_path):
7171 for chapter in root .findall ("./chapter" ):
7272 logger .info (chapter )
7373 chap += 1
74- logger .debug (chapter .tag , chapter .find (
75- "./id" ).text , chapter .find ("./title" ).text )
74+ logger .debug (
75+ chapter .tag , chapter .find ("./id" ).text , chapter .find ("./title" ).text
76+ )
7677 ins = chapters .insert ().values (
7778 chapter_name = chapter .find ("./title" ).text ,
7879 course_id = course_name ,
@@ -93,8 +94,10 @@ def manifest_data_to_db(course_name, manifest_path):
9394 titletext = subchapter .find ("./title" ).text
9495 if not titletext :
9596 titletext = " " .join (
96- [ET .tostring (y ).decode ("utf8" )
97- for y in subchapter .findall ("./title/*" )]
97+ [
98+ ET .tostring (y ).decode ("utf8" )
99+ for y in subchapter .findall ("./title/*" )
100+ ]
98101 )
99102 ins = subchapters .insert ().values (
100103 sub_chapter_name = titletext ,
@@ -142,13 +145,12 @@ def manifest_data_to_db(course_name, manifest_path):
142145
143146 for question in subchapter .findall ("./question" ):
144147 dbtext = " " .join (
145- [ET .tostring (y ).decode ("utf8" )
146- for y in question .findall ("./htmlsrc/*" )]
147- )
148- qlabel = " " .join (
149- [y .text
150- for y in question .findall ("./label" )]
148+ [
149+ ET .tostring (y ).decode ("utf8" )
150+ for y in question .findall ("./htmlsrc/*" )
151+ ]
151152 )
153+ qlabel = " " .join ([y .text for y in question .findall ("./label" )])
152154 logger .debug (f"found label= { qlabel } " )
153155 logger .debug ("looking for data-component" )
154156 # pdb.set_trace()
@@ -173,6 +175,7 @@ def manifest_data_to_db(course_name, manifest_path):
173175 qtype = QT_MAP .get (qtype , qtype )
174176 except :
175177 qtype = "webwork"
178+ dbtext = ET .tostring (el ).decode ("utf8" )
176179 valudict = dict (
177180 base_course = course_name ,
178181 name = idchild ,
0 commit comments