From ba9c2a328010b0537f248ab20dc505b40a4c2e7e Mon Sep 17 00:00:00 2001 From: Alexander Nitsch Date: Wed, 20 Oct 2021 10:57:13 +0200 Subject: [PATCH] Fix initialization of local variable "data" (#1813) Co-authored-by: Nitsch Alexander --- src/bcf/src/bcf/v3/bcfxml.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bcf/src/bcf/v3/bcfxml.py b/src/bcf/src/bcf/v3/bcfxml.py index 9d9578e576..429bb2258a 100644 --- a/src/bcf/src/bcf/v3/bcfxml.py +++ b/src/bcf/src/bcf/v3/bcfxml.py @@ -645,9 +645,10 @@ class BcfXml: def get_comments(self, guid): comments = {} + data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd") if "Comments" not in data["Topics"]: return comments - data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd") + for item in data["Topic"]["Comments"].get("Comment", []): comment = bcf.v3.data.Comment() mandatory_keys = { @@ -675,9 +676,9 @@ class BcfXml: def get_viewpoints(self, guid): viewpoints = {} + data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd") if "Viewpoints" not in data["Topic"]: return viewpoints - data = self._read_xml(os.path.join(guid, "markup.bcf"), "markup.xsd") for item in data["Topic"]["Viewpoints"]: viewpoint = self.get_viewpoint(item, guid) viewpoints[viewpoint.guid] = viewpoint