[Python-checkins] r80678 - in python/branches/release31-maint: Lib/test/test_urllibnet.py Lib/urllib/request.py
senthil.kumaran
python-checkins at python.org
Sat May 1 10:32:23 CEST 2010
Author: senthil.kumaran
Date: Sat May 1 10:32:23 2010
New Revision: 80678
Log:
Merged revisions 80677 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r80677 | senthil.kumaran | 2010-05-01 13:59:18 +0530 (Sat, 01 May 2010) | 9 lines
Merged revisions 80675 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80675 | senthil.kumaran | 2010-05-01 13:31:56 +0530 (Sat, 01 May 2010) | 3 lines
Fix issue8582: urllib.urlretrieve fails with ValueError: Invalid format string
........
................
Modified:
python/branches/release31-maint/ (props changed)
python/branches/release31-maint/Lib/test/test_urllibnet.py
python/branches/release31-maint/Lib/urllib/request.py
Modified: python/branches/release31-maint/Lib/test/test_urllibnet.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_urllibnet.py (original)
+++ python/branches/release31-maint/Lib/test/test_urllibnet.py Sat May 1 10:32:23 2010
@@ -8,6 +8,7 @@
import sys
import os
import email.message
+import time
def _open_with_retry(func, host, *args, **kwargs):
@@ -180,6 +181,16 @@
self.assertTrue(isinstance(header, email.message.Message),
"header is not an instance of email.message.Message")
+ def test_data_header(self):
+ logo = "http://www.python.org/community/logos/python-logo-master-v3-TM.png"
+ file_location, fileheaders = self.urlretrieve(logo)
+ os.unlink(file_location)
+ datevalue = fileheaders.get('Date')
+ dateformat = '%a, %d %b %Y %H:%M:%S GMT'
+ try:
+ time.strptime(datevalue, dateformat)
+ except ValueError:
+ self.fail('Date value not in %r format', dateformat)
def test_main():
Modified: python/branches/release31-maint/Lib/urllib/request.py
==============================================================================
--- python/branches/release31-maint/Lib/urllib/request.py (original)
+++ python/branches/release31-maint/Lib/urllib/request.py Sat May 1 10:32:23 2010
@@ -1781,7 +1781,7 @@
else:
encoding = ''
msg = []
- msg.append('Date: %s'%time.strftime('%a, %d %b %Y %T GMT',
+ msg.append('Date: %s'%time.strftime('%a, %d %b %Y %H:%M:%S GMT',
time.gmtime(time.time())))
msg.append('Content-type: %s' % type)
if encoding == 'base64':
More information about the Python-checkins
mailing list