Author terry.reedy
Recipients alanmcintyre, proppy, terry.reedy
Date 2011-05-07.01:20:38
SpamBayes Score 4.86317e-07
Marked as misclassified No
Message-id <1304731240.92.0.112266737226.issue11980@psf.upfronthosting.co.za>
In-reply-to
Content
zipfile.ZipFile takes a file arg that can be a 'path to a file (a string) or a file-like object'. The .write() method takes a filename arg. I would think that the proposal should be what the title says, to expand that to a file arg, either a path or 'file', as with ZipFile itself. I cannot think of any reason not to do that.

The patch adds a separate .writefp method with the file and arcname switched and the compression_type omitted. The code is mostly a duplicated subset of .write. While is proves the concept, none of the differences strike me as good. I think instead there should just be one method that branches, where appropriate, on the type of 'file', just as ZipFile.__init__ does. I admit that I do not understand what .write is supposed to do or does do when filename is a directory.

The patch includes a test. It still needs doc and News patches, but those come after the basic patch is done.
History
Date User Action Args
2011-05-07 01:20:41terry.reedysetrecipients: + terry.reedy, alanmcintyre, proppy
2011-05-07 01:20:40terry.reedysetmessageid: <1304731240.92.0.112266737226.issue11980@psf.upfronthosting.co.za>
2011-05-07 01:20:39terry.reedylinkissue11980 messages
2011-05-07 01:20:38terry.reedycreate