Skip to content

Commit 11c45e5

Browse files
author
Steve Canny
committed
release: v0.3.0a5; hotfix issue python-openxml#4
iss4: Document.add_picture() fails on second and subsequent images.
1 parent 00123a4 commit 11c45e5

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

HISTORY.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
Release History
44
---------------
55

6+
0.3.0a5 (2014-01-10)
7+
++++++++++++++++++++++
8+
9+
- Hotfix: issue #4, Document.add_picture() fails on second and subsequent
10+
images.
11+
12+
613
0.3.0a4 (2014-01-07)
714
++++++++++++++++++++++
815

916
- Complete Python 3 support, tested on Python 3.3
1017

18+
1119
0.3.0a3 (2014-01-06)
1220
++++++++++++++++++++++
1321

1422
- Fix setup.py error on some Windows installs
1523

24+
1625
0.3.0a1 (2014-01-05)
1726
++++++++++++++++++++++
1827

@@ -25,6 +34,7 @@ Release History
2534
- breaks: add page break
2635
- tests: full pytest and behave-based 2-layer test suite
2736

37+
2838
0.3.0dev1 (2013-12-14)
2939
++++++++++++++++++++++
3040

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.3.0a4'
5+
__version__ = '0.3.0a5'
66

77

88
# register custom Part classes with opc package reader

docx/parts/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,4 @@ def sha1(self):
265265
"""
266266
SHA1 hash digest of the blob of this image part.
267267
"""
268-
raise NotImplementedError
268+
return hashlib.sha1(self._blob).hexdigest()

tests/parts/test_image.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ def it_knows_its_filename(self, filename_fixture):
116116
image_part, expected_filename = filename_fixture
117117
assert image_part.filename == expected_filename
118118

119+
def it_knows_the_sha1_of_its_image(self):
120+
blob = b'fO0Bar'
121+
image_part = ImagePart(None, None, blob)
122+
assert image_part.sha1 == '4921e7002ddfba690a937d54bda226a7b8bdeb68'
123+
119124
# fixtures -------------------------------------------------------
120125

121126
@pytest.fixture

0 commit comments

Comments
 (0)