Skip to content

Commit

Permalink
hotfix: v0.5.1 fix iss#23
Browse files Browse the repository at this point in the history
Document.add_picture() raises ValueError when document contains VML
drawing
  • Loading branch information
Steve Canny committed Apr 3, 2014
1 parent 69eb559 commit 460cae6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
---------------

0.5.1 (2014-04-02)
++++++++++++++++++

- Fix issue #23, `Document.add_picture()` raises ValueError when document
contains VML drawing.


0.5.0 (2014-03-02)
++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion docx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from docx.api import Document # noqa

__version__ = '0.5.0'
__version__ = '0.5.1'


# register custom Part classes with opc package reader
Expand Down
2 changes: 1 addition & 1 deletion docx/parts/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def next_id(self):
document, without regard to the element type it appears on.
"""
id_str_lst = self._element.xpath('//@id')
used_ids = [int(id_str) for id_str in id_str_lst]
used_ids = [int(id_str) for id_str in id_str_lst if id_str.isdigit()]
for n in range(1, len(used_ids)+2):
if n not in used_ids:
return n
Expand Down
2 changes: 1 addition & 1 deletion tests/parts/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def inline_shapes_fixture(self, request, InlineShapes_):

@pytest.fixture(params=[
((), 1), ((1,), 2), ((2,), 1), ((1, 2, 3), 4), ((1, 2, 4), 3),
((0, 0), 1), ((0, 0, 1, 3), 2),
((0, 0), 1), ((0, 0, 1, 3), 2), (('foo', 1, 2), 3), ((1, 'bar'), 2)
])
def next_id_fixture(self, request):
existing_ids, expected_id = request.param
Expand Down

0 comments on commit 460cae6

Please sign in to comment.