summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-14 22:58:05 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-01-14 22:58:05 (GMT)
commit351e1a3e8805bca158d1f116a637e787e2b70f18 (patch)
treecc46bfa7e030420a504a6bc55e98df7ab41e6882 /Lib/zipfile.py
parent5d8b379abcf9e200122c7c95fbf012a5c9ef8e32 (diff)
downloadcpython-351e1a3e8805bca158d1f116a637e787e2b70f18.zip
cpython-351e1a3e8805bca158d1f116a637e787e2b70f18.tar.gz
cpython-351e1a3e8805bca158d1f116a637e787e2b70f18.tar.bz2
Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index ab9c93f..471cffc 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -710,7 +710,7 @@ class ZipFile:
"""Print a table of contents for the zip file."""
print "%-46s %19s %12s" % ("File Name", "Modified ", "Size")
for zinfo in self.filelist:
- date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time
+ date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size)
def testzip(self):
@@ -961,7 +961,7 @@ class ZipFile:
the name of the file in the archive."""
if not isinstance(zinfo_or_arcname, ZipInfo):
zinfo = ZipInfo(filename=zinfo_or_arcname,
- date_time=time.localtime(time.time()))
+ date_time=time.localtime(time.time())[:6])
zinfo.compress_type = self.compression
else:
zinfo = zinfo_or_arcname