From cf9e425c0eb256dea31b912f66184378fca1dac2 Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Mon, 8 Jul 2024 13:34:17 -0400 Subject: [PATCH] Import export updates (#609) * Box - gamelevel as element - Export gamelevel as element since import uses this and not the attribute * Add plain_answer - Import/export of the plain_answer --- models/Box.py | 1 + models/Flag.py | 1 + setup/xmlsetup.py | 1 + 3 files changed, 3 insertions(+) diff --git a/models/Box.py b/models/Box.py index 71740a31..3d25e1e8 100644 --- a/models/Box.py +++ b/models/Box.py @@ -410,6 +410,7 @@ def to_xml(self, parent): box_elem = ET.SubElement(parent, "box") box_elem.set("gamelevel", "%s" % str(self.game_level.number)) ET.SubElement(box_elem, "name").text = self.name + ET.SubElement(box_elem, "gamelevel").text = str(self.game_level.number) ET.SubElement(box_elem, "operatingsystem").text = self._operating_system ET.SubElement(box_elem, "description").text = self._description ET.SubElement(box_elem, "capture_message").text = self.capture_message diff --git a/models/Flag.py b/models/Flag.py index 2248eccf..f03a6df5 100644 --- a/models/Flag.py +++ b/models/Flag.py @@ -462,6 +462,7 @@ def to_xml(self, parent): ET.SubElement(flag_elem, "description").text = self.description ET.SubElement(flag_elem, "capture_message").text = self.capture_message ET.SubElement(flag_elem, "value").text = str(self.value) + ET.SubElement(flag_elem, "plain_answer").text = str(self._plain_answer) ET.SubElement(flag_elem, "locked").text = str(self.locked) if self.lock_id: ET.SubElement(flag_elem, "depends_on").text = Flag.by_id(self.lock_id).name diff --git a/setup/xmlsetup.py b/setup/xmlsetup.py index c5cf71ac..b61b07ad 100644 --- a/setup/xmlsetup.py +++ b/setup/xmlsetup.py @@ -144,6 +144,7 @@ def create_flags(parent, box): flag.name = get_child_text(flag_elem, "name") flag.token = get_child_text(flag_elem, "token") flag.value = get_child_text(flag_elem, "value", 10) + flag._plain_answer = get_child_text(flag_elem, "plain_answer") flag.case_sensitive = get_child_text(flag_elem, "case_sensitive", 0) flag.description = get_child_text(flag_elem, "description") flag.capture_message = get_child_text(flag_elem, "capture_message")