aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/body_xml.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2018-01-19 19:36:56 +0000
committerMichael Williamson <mike@zwobble.org>2018-01-19 19:36:56 +0000
commit882f1aff778b56bbc15222baa0555616f8e102ac (patch)
tree931fa395a4ec7a3307cf4a8d96491d5918888ed2 /mammoth/docx/body_xml.py
parentceb05a609ee9323ab0ecea9aee473939f1149461 (diff)
Replace __getitem__ with find_target_by_relationship_id on Relationships
Diffstat (limited to 'mammoth/docx/body_xml.py')
-rw-r--r--mammoth/docx/body_xml.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index cfe3493..cdba409 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -341,7 +341,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
))
if relationship_id is not None:
- href = relationships[relationship_id].target
+ href = relationships.find_target_by_relationship_id(relationship_id)
if anchor is not None:
href = replace_fragment(href, anchor)
@@ -414,7 +414,8 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
return _find_linked_image(link_relationship_id)
def _find_embedded_image(relationship_id):
- image_path = uri_to_zip_entry_name("word", relationships[relationship_id].target)
+ target = relationships.find_target_by_relationship_id(relationship_id)
+ image_path = uri_to_zip_entry_name("word", target)
def open_image():
image_file = docx_file.open(image_path)
@@ -427,7 +428,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
def _find_linked_image(relationship_id):
- image_path = relationships[relationship_id].target
+ image_path = relationships.find_target_by_relationship_id(relationship_id)
def open_image():
return files.open(image_path)