Skip to content

Commit d69a246

Browse files
Process source code and datafiles in PTX appendices
1 parent f8f3eb2 commit d69a246

File tree

1 file changed

+18
-0
lines changed
  • components/rsptx/build_tools

1 file changed

+18
-0
lines changed

components/rsptx/build_tools/core.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,9 @@ def manifest_data_to_db(course_name, manifest_path):
538538
# Process chapters and content
539539
_process_chapters(sess, db_context, course_name, manifest_path)
540540

541+
# And appendices. They should not have questions, but may have source code/datafiles
542+
_process_appendices(sess, db_context, course_name, manifest_path)
543+
541544
# Set course attributes
542545
_set_course_attributes(sess, db_context, course_name, manifest_path)
543546

@@ -623,6 +626,21 @@ def _process_chapters(sess, db_context, course_name, manifest_path):
623626
_process_subchapters(sess, db_context, chapter, chapid, course_name)
624627

625628

629+
def _process_appendices(sess, db_context, course_name, manifest_path):
630+
"""Process all appendices from the manifest."""
631+
rslogger.info("Populating the database with Appendix information")
632+
633+
tree = ET.parse(manifest_path)
634+
root = tree.getroot()
635+
636+
for appendix in root.findall("./appendix"):
637+
_process_source_elements(sess, appendix, course_name)
638+
639+
for data_file in appendix.findall("./datafile"):
640+
el = data_file.find(".//*[@data-component]")
641+
_handle_datafile(el, course_name)
642+
643+
626644
def _process_single_chapter(sess, db_context, chapter, chap_num, course_name):
627645
"""Process a single chapter and return its database ID."""
628646
rslogger.info(chapter)

0 commit comments

Comments
 (0)