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 BitTorment
Recipients BitTorment, alanmcintyre, georg.brandl, techtonik
Date 2008-05-13.12:42:21
SpamBayes Score 0.08227437
Marked as misclassified No
Message-id <1210682550.65.0.193969882479.issue2824@psf.upfronthosting.co.za>
In-reply-to
Content
The mechanism for throwing an error has been written, however for the
case of a duplicated filename, it appears to have been deliberatly not
been used by the original author.:

 def _writecheck(self, zinfo):
        """Check for errors before writing a file to the archive."""
        if zinfo.filename in self.NameToInfo:
            if self.debug:      # Warning for duplicate names
                print "Duplicate name:", zinfo.filename
        if self.mode not in ("w", "a"):
            raise RuntimeError, 'write() requires mode "w" or "a"'
        ...

Putting a 'replace=True' switch seems a little clumsy, it would be much
better to raise an error, or allow the user a way to globally control
what happens in this case, i.e. overwrite the existing file or drop it.
 Adding a global behaviour switch seems to be the best way to preserve
backwards compatibility.

What do people think is the best way?

-- Martin
History
Date User Action Args
2008-05-13 12:42:31BitTormentsetspambayes_score: 0.0822744 -> 0.08227437
recipients: + BitTorment, georg.brandl, alanmcintyre, techtonik
2008-05-13 12:42:30BitTormentsetspambayes_score: 0.0822744 -> 0.0822744
messageid: <1210682550.65.0.193969882479.issue2824@psf.upfronthosting.co.za>
2008-05-13 12:42:27BitTormentlinkissue2824 messages
2008-05-13 12:42:26BitTormentcreate