summaryrefslogtreecommitdiffstats
path: root/Doc/library/zipfile.rst
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2010-02-07 20:18:02 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2010-02-07 20:18:02 (GMT)
commitdd25e86cf47365269466bf0d28367d5f6dbc0c18 (patch)
tree52c07099a891d84a1e140d1524ebe4b42e0424aa /Doc/library/zipfile.rst
parent2bd52dcccbd38908ae2a3b3bdceb3b04d6b16c81 (diff)
downloadcpython-dd25e86cf47365269466bf0d28367d5f6dbc0c18.zip
cpython-dd25e86cf47365269466bf0d28367d5f6dbc0c18.tar.gz
cpython-dd25e86cf47365269466bf0d28367d5f6dbc0c18.tar.bz2
Issue 6003: ZipFile.writestr "compression_type" argument
Diffstat (limited to 'Doc/library/zipfile.rst')
-rw-r--r--Doc/library/zipfile.rst9
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 0d5f205..cbaf0a6 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -284,7 +284,7 @@ ZipFile Objects
byte, the name of the file in the archive will be truncated at the null byte.
-.. method:: ZipFile.writestr(zinfo_or_arcname, bytes)
+.. method:: ZipFile.writestr(zinfo_or_arcname, bytes[, compress_type])
Write the string *bytes* to the archive; *zinfo_or_arcname* is either the file
name it will be given in the archive, or a :class:`ZipInfo` instance. If it's
@@ -294,6 +294,10 @@ ZipFile Objects
created with mode ``'r'`` will raise a :exc:`RuntimeError`. Calling
:meth:`writestr` on a closed ZipFile will raise a :exc:`RuntimeError`.
+ If given, *compress_type* overrides the value given for the *compression*
+ parameter to the constructor for the new entry, or in the *zinfo_or_arcname*
+ (if that is a :class:`ZipInfo` instance).
+
.. note::
When passing a :class:`ZipInfo` instance as the *zinfo_or_acrname* parameter,
@@ -301,6 +305,9 @@ ZipFile Objects
member of the given :class:`ZipInfo` instance. By default, the
:class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`.
+ .. versionchanged:: 2.7
+ The *compression_type* argument.
+
The following data attributes are also available: