aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-01-21 19:44:02 +0000
committerMichael Williamson <mike@zwobble.org>2015-01-21 19:44:02 +0000
commit2a8859cfbaaddc2350f779b0bc6aa169dfc4b381 (patch)
treea9dd43795d5611da10255ab3e57f8ee53202087b /mammoth/docx
parentc54f9f8dbda71677b9562dcb763ca637c021449e (diff)
Read numbering.xml using common code
Diffstat (limited to 'mammoth/docx')
-rw-r--r--mammoth/docx/__init__.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/mammoth/docx/__init__.py b/mammoth/docx/__init__.py
index 8496cd9..588ce2c 100644
--- a/mammoth/docx/__init__.py
+++ b/mammoth/docx/__init__.py
@@ -28,12 +28,9 @@ def read(fileobj):
with _open_entry(zip_file, "word/_rels/document.xml.rels") as relationships_fileobj:
relationships = read_relationships_xml_element(_parse_docx_xml(relationships_fileobj))
-
- if _has_entry(zip_file, "word/numbering.xml"):
- with _open_entry(zip_file, "word/numbering.xml") as numbering_fileobj:
- numbering = read_numbering_xml_element(_parse_docx_xml(numbering_fileobj))
- else:
- numbering = Numbering({})
+
+ numbering = _try_read_entry_or_default(
+ zip_file, "word/numbering.xml", read_numbering_xml_element, default=Numbering({}))
with _open_entry(zip_file, "word/styles.xml") as styles_fileobj:
styles = read_styles_xml_element(_parse_docx_xml(styles_fileobj))