Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 460cae6

Browse files
author
Steve Canny
committed
hotfix: v0.5.1 fix iss#23
Document.add_picture() raises ValueError when document contains VML drawing
1 parent 69eb559 commit 460cae6

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

HISTORY.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
Release History
44
---------------
55

6+
0.5.1 (2014-04-02)
7+
++++++++++++++++++
8+
9+
- Fix issue #23, `Document.add_picture()` raises ValueError when document
10+
contains VML drawing.
11+
12+
613
0.5.0 (2014-03-02)
714
++++++++++++++++++
815

docx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from docx.api import Document # noqa
44

5-
__version__ = '0.5.0'
5+
__version__ = '0.5.1'
66

77

88
# register custom Part classes with opc package reader

docx/parts/document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def next_id(self):
8787
document, without regard to the element type it appears on.
8888
"""
8989
id_str_lst = self._element.xpath('//@id')
90-
used_ids = [int(id_str) for id_str in id_str_lst]
90+
used_ids = [int(id_str) for id_str in id_str_lst if id_str.isdigit()]
9191
for n in range(1, len(used_ids)+2):
9292
if n not in used_ids:
9393
return n

tests/parts/test_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def inline_shapes_fixture(self, request, InlineShapes_):
244244

245245
@pytest.fixture(params=[
246246
((), 1), ((1,), 2), ((2,), 1), ((1, 2, 3), 4), ((1, 2, 4), 3),
247-
((0, 0), 1), ((0, 0, 1, 3), 2),
247+
((0, 0), 1), ((0, 0, 1, 3), 2), (('foo', 1, 2), 3), ((1, 'bar'), 2)
248248
])
249249
def next_id_fixture(self, request):
250250
existing_ids, expected_id = request.param

0 commit comments

Comments
 (0)