homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ZipFile.writestr "compression_type" argument
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: benjamin.peterson, pitrou, ronaldoussoren
Priority: normal Keywords: patch

Created on 2009年05月12日 09:36 by ronaldoussoren, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile_writestr.patch ronaldoussoren, 2009年05月19日 20:14
Messages (8)
msg87610 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009年05月12日 09:36
Class zipfile.ZipFile has two methods for adding data to a zipfile: 
'write' and 'writestr'.
The former has a "compression_type" argument that can be used to specify 
the compression to be used. That latter doesn't have that argument.
Could a "compression_type" argument be added to "writestr" as well? I 
regularly create zipfiles from scratch using the writestr method to add 
content and currently have to modify the 'compression' attribute of the 
zipfile object to control compression and that leads to ugly code.
The other alternative is to use a ZipInfo object as the archive-name of 
the newly added file, but that leads to even uglier code.
msg87625 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009年05月12日 13:24
This sounds like a good idea. Can you provide a patch (including tests)?
msg87627 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009年05月12日 13:30
I will.
I guess it's too late to merge this into 3.1 (as the first beta has 
already been released).
msg87629 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009年05月12日 13:33
> I guess it's too late to merge this into 3.1 (as the first beta has 
> already been released).
Since the change should be small and uncontroversial, I think it could
go in.
Benjamin has the final word.
msg88096 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009年05月19日 20:14
The attached patch implements my proposal, including documentation and 
tests. I'm not 100% happy about the tests, they may be a bit too minimal.
msg88097 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009年05月19日 20:15
Argh... The patch includes an update to configure.in, please ignore that 
bit.
msg88437 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009年05月27日 19:53
The patch looks ok. It can certainly go in trunk, as for 3.1 it's up to
Benjamin to decide.
Note: the docs should state that the new argument appeared in 2.7.
msg99015 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010年02月07日 20:24
Committed in r78097 (trunk) and r78098 (3.2). This includes the documentation change suggested in msg88437 
History
Date User Action Args
2022年04月11日 14:56:48adminsetgithub: 50253
2010年02月07日 20:24:58ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg99015

stage: needs patch -> resolved
2009年05月27日 19:53:21pitrousetmessages: + msg88437
2009年05月19日 20:15:29ronaldoussorensetmessages: + msg88097
2009年05月19日 20:14:25ronaldoussorensetfiles: + zipfile_writestr.patch
keywords: + patch
messages: + msg88096
2009年05月12日 13:33:22pitrousetnosy: + benjamin.peterson
messages: + msg87629
2009年05月12日 13:30:14ronaldoussorensetmessages: + msg87627
2009年05月12日 13:24:27pitrousetpriority: normal

nosy: + pitrou
messages: + msg87625

assignee: ronaldoussoren
components: + Library (Lib)
2009年05月12日 09:36:45ronaldoussorencreate

AltStyle によって変換されたページ (->オリジナル) /