fixed issue when sorting hook when saving to xml, due to enum refactoring, updated test case to hit this potential issue in the future

This commit is contained in:
Blake Harnden 2020-05-11 12:41:57 -07:00
parent 3fac6bc7ec
commit 124d655dc6
2 changed files with 7 additions and 2 deletions

View file

@ -312,7 +312,7 @@ class CoreXmlWriter:
def write_session_hooks(self) -> None:
# hook scripts
hooks = etree.Element("session_hooks")
for state in sorted(self.session._hooks.keys()):
for state in sorted(self.session._hooks, key=lambda x: x.value):
for file_name, data in self.session._hooks[state]:
hook = etree.SubElement(hooks, "hook")
add_attribute(hook, "name", file_name)