classification
Title: small ZipFile.writestr() enhancement
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
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.

Files
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("myarchive.zip", "w")
    z.writestr("foo/baz/file.ext", data)
    z.close()

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.

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

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

Thanks Martin, for the speedy review!

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