Title: small ZipFile.writestr() enhancement
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: jvr Nosy List: jvr, loewis
Priority: normal Keywords: patch

Created on 2002-12-10 20:31 by jvr, last changed 2002-12-12 12:25 by jvr. This issue is now closed.

File name Uploaded Description Edit
zipfile.patch jvr, 2002-12-10 21:27 ZipFile.writestr() enhancement
Messages (3)
msg41945 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2002-12-10 20:31
This patch allows ZipFile.writestr() to be called with
an archive file name instead of a ZipInfo instance:

    z = ZipFile("", "w")
    z.writestr("foo/baz/file.ext", data)

I find the current writestr() method very inconvenient
for simple (but common) things.

If called with a file name instead of a ZipInfo
instance, the date_time is set to now, which makes most
sense for anonymous data.

The patch also patches Doc/Lib/libzipfile.tex.

msg41946 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-12-12 11:16
Logged In: YES 

Looks fine, please apply.
msg41947 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2002-12-12 12:25
Logged In: YES 

Thanks Martin, for the speedy review!

Checked in as
Doc/lib/libzipfile.tex revision 1.15
Lib/ revision 1.27
Date User Action Args
2002-12-10 20:31:25jvrcreate