summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-01-23 20:39:05 +0000
committerMichael Williamson <mike@zwobble.org>2017-01-23 20:39:05 +0000
commite23fe00ff2a8fb3c796bfcc600dcc58dba902fa5 (patch)
treebab8590db32f6aa337d9b9fb24ecf329b9a2582e
parenta47b5579acd8314d8543d306571dee93ac505667 (diff)
Move target URI handling out of zips module
-rw-r--r--mammoth/docx/body_xml.py2
-rw-r--r--mammoth/docx/uris.py5
-rw-r--r--mammoth/zips.py7
-rw-r--r--tests/docx/uris_tests.py (renamed from tests/zips_tests.py)2
4 files changed, 7 insertions, 9 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index 433d5a2..6c2c501 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -3,9 +3,9 @@ import contextlib
from .. import documents
from .. import results
from .. import lists
-from ..zips import uri_to_zip_entry_name
from .xmlparser import node_types, XmlElement
from .styles_xml import Styles
+from .uris import uri_to_zip_entry_name
def reader(numbering=None,
diff --git a/mammoth/docx/uris.py b/mammoth/docx/uris.py
new file mode 100644
index 0000000..59f3ffe
--- /dev/null
+++ b/mammoth/docx/uris.py
@@ -0,0 +1,5 @@
+def uri_to_zip_entry_name(base, uri):
+ if uri.startswith("/"):
+ return uri[1:]
+ else:
+ return base + "/" + uri
diff --git a/mammoth/zips.py b/mammoth/zips.py
index 8e09924..432be5d 100644
--- a/mammoth/zips.py
+++ b/mammoth/zips.py
@@ -54,10 +54,3 @@ def update_zip(fileobj, files):
fileobj.seek(0)
destination_fileobj.seek(0)
shutil.copyfileobj(destination_fileobj, fileobj)
-
-
-def uri_to_zip_entry_name(base, uri):
- if uri.startswith("/"):
- return uri[1:]
- else:
- return base + "/" + uri
diff --git a/tests/zips_tests.py b/tests/docx/uris_tests.py
index bef9895..6b9c264 100644
--- a/tests/zips_tests.py
+++ b/tests/docx/uris_tests.py
@@ -1,6 +1,6 @@
from nose.tools import istest, assert_equal
-from mammoth.zips import uri_to_zip_entry_name
+from mammoth.docx.uris import uri_to_zip_entry_name
@istest