Remove extension testing in replace_pic()
This commit is contained in:
parent
74d46579be
commit
3b4de31734
@ -1,3 +1,7 @@
|
|||||||
|
0.10.1 (2020-05-25)
|
||||||
|
-------------------
|
||||||
|
- Remove extension testing (#297)
|
||||||
|
|
||||||
0.10.0 (2020-05-25)
|
0.10.0 (2020-05-25)
|
||||||
-------------------
|
-------------------
|
||||||
- Fix spaces missing in some cases (#116, #227)
|
- Fix spaces missing in some cases (#116, #227)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ Created : 2015-03-12
|
|||||||
import functools
|
import functools
|
||||||
import io
|
import io
|
||||||
|
|
||||||
__version__ = '0.10.0'
|
__version__ = '0.10.1'
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
from docx import Document
|
from docx import Document
|
||||||
@ -446,12 +446,6 @@ class DocxTemplate(object):
|
|||||||
# NOTE: file extension not checked
|
# NOTE: file extension not checked
|
||||||
self.pic_to_replace[embedded_file] = dst_file.read()
|
self.pic_to_replace[embedded_file] = dst_file.read()
|
||||||
else:
|
else:
|
||||||
emp_path, emb_ext = os.path.splitext(embedded_file)
|
|
||||||
dst_path, dst_ext = os.path.splitext(dst_file)
|
|
||||||
|
|
||||||
if emb_ext != dst_ext:
|
|
||||||
raise ValueError('replace_pic: extensions must match')
|
|
||||||
|
|
||||||
with open(dst_file, 'rb') as fh:
|
with open(dst_file, 'rb') as fh:
|
||||||
self.pic_to_replace[embedded_file] = fh.read()
|
self.pic_to_replace[embedded_file] = fh.read()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user