Skip to content

Commit a2b5b8f

Browse files
author
Arjan Schrijver
committed
Add date_time parameter to writestr() too
1 parent 1cf1fa9 commit a2b5b8f

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
This file details the changes that were made after forking v1.1.4 from https://github.com/allanlei/python-zipstream.
44

5-
## v1.1.5 (2019-03-18)
6-
* Support Zip64 when compressing iterables and strings (https://github.com/allanlei/python-zipstream/pull/25)
5+
## Unreleased
6+
* New datetime parameter in write_iter (https://github.com/arjan-s/python-zipstream/pull/8)
7+
8+
## v1.1.7 (2019-10-22)
9+
* Stream data in the order it was received (https://github.com/arjan-s/python-zipstream/pull/4)
710

811
## v1.1.6 (2019-06-06)
912
* Add partial flushing of ZipStreams (https://github.com/arjan-s/python-zipstream/pull/1)
1013

11-
## v1.1.7 (2019-10-22)
12-
* Stream data in the order it was received (https://github.com/arjan-s/python-zipstream/pull/4)
14+
## v1.1.5 (2019-03-18)
15+
* Support Zip64 when compressing iterables and strings (https://github.com/allanlei/python-zipstream/pull/25)

zipstream/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,13 @@ def write_iter(self, arcname, iterable, compress_type=None, buffer_size=None, da
225225
kwargs = {'arcname': arcname, 'iterable': iterable, 'compress_type': compress_type, 'buffer_size': buffer_size, 'date_time': date_time}
226226
self.paths_to_write.append(kwargs)
227227

228-
def writestr(self, arcname, data, compress_type=None, buffer_size=None):
228+
def writestr(self, arcname, data, compress_type=None, buffer_size=None, date_time=None):
229229
"""
230230
Writes a str into ZipFile by wrapping data as a generator
231231
"""
232232
def _iterable():
233233
yield data
234-
return self.write_iter(arcname, _iterable(), compress_type=compress_type, buffer_size=buffer_size)
234+
return self.write_iter(arcname, _iterable(), compress_type=compress_type, buffer_size=buffer_size, date_time=date_time)
235235

236236
def __write(self, filename=None, iterable=None, arcname=None, compress_type=None, buffer_size=None, date_time=None):
237237
"""Put the bytes from filename into the archive under the name

0 commit comments

Comments
 (0)