summaryrefslogtreecommitdiff
path: root/libmat2
diff options
context:
space:
mode:
Diffstat (limited to 'libmat2')
-rw-r--r--libmat2/office.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/libmat2/office.py b/libmat2/office.py
index e79fe58..224067c 100644
--- a/libmat2/office.py
+++ b/libmat2/office.py
@@ -84,6 +84,11 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
84 84
85 def remove_all(self) -> bool: 85 def remove_all(self) -> bool:
86 # pylint: disable=too-many-branches 86 # pylint: disable=too-many-branches
87
88 if self.unknown_member_policy not in ['omit', 'keep', 'abort']:
89 logging.error("The policy %s is invalid.", self.unknown_member_policy)
90 raise ValueError
91
87 with zipfile.ZipFile(self.filename) as zin,\ 92 with zipfile.ZipFile(self.filename) as zin,\
88 zipfile.ZipFile(self.output_filename, 'w') as zout: 93 zipfile.ZipFile(self.output_filename, 'w') as zout:
89 94
@@ -120,9 +125,6 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
120 logging.warning("In file %s, keeping unknown element %s (format: %s)", 125 logging.warning("In file %s, keeping unknown element %s (format: %s)",
121 self.filename, item.filename, mtype) 126 self.filename, item.filename, mtype)
122 else: 127 else:
123 if self.unknown_member_policy != 'abort':
124 logging.warning("Invalid unknown_member_policy %s, " +
125 "treating as 'abort'", self.unknown_member_policy)
126 logging.error("In file %s, element %s's format (%s) " + 128 logging.error("In file %s, element %s's format (%s) " +
127 "isn't supported", 129 "isn't supported",
128 self.filename, item.filename, mtype) 130 self.filename, item.filename, mtype)