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.

Author chroipahtz
Recipients chroipahtz, lars.gustaebel, loewis, rhettinger, rossmclendon, victorlee129
Date 2010-07-03.05:26:37
SpamBayes Score 0.0077698166
Marked as misclassified No
Message-id <1278134802.59.0.82246408284.issue6818@psf.upfronthosting.co.za>
In-reply-to
Content
I have attempted to implement a ZipFile.remove function.  It seems to work fine.  I have submitted a patch.

The method of implementation is: find the file's index in the file list, then sum the lengths of the file entries before it to find its location in the archive.  Then simply read in all the bytes after it, write them out at that location, and truncate the file x bytes shorter, where x is the length of the record.  This works because the directory listing is created when the file is closed, so there's no harm in truncating.

I've also made it truncate the zip file after reading in the existing files upon creation, because the directory information is not used after this point.

This could use some testing on large files.

This is my first patch, so let me know if I've done anything wrong.
History
Date User Action Args
2010-07-03 05:26:43chroipahtzsetrecipients: + chroipahtz, loewis, rhettinger, lars.gustaebel, rossmclendon, victorlee129
2010-07-03 05:26:42chroipahtzsetmessageid: <1278134802.59.0.82246408284.issue6818@psf.upfronthosting.co.za>
2010-07-03 05:26:40chroipahtzlinkissue6818 messages
2010-07-03 05:26:39chroipahtzcreate