[Python-checkins] python/dist/src/Lib urllib.py, 1.164,
1.165 urllib2.py, 1.76, 1.77
anthonybaxter at users.sourceforge.net
anthonybaxter at users.sourceforge.net
Mon Oct 11 15:53:16 CEST 2004
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26235/Lib
Modified Files:
urllib.py urllib2.py
Log Message:
Added a usegmt flag to email.Utils.formatdate - this allows it to be
used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must
be the timezone string).
Index: urllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- urllib.py 18 Jul 2004 06:14:41 -0000 1.164
+++ urllib.py 11 Oct 2004 13:53:07 -0000 1.165
@@ -410,7 +410,7 @@
def open_local_file(self, url):
"""Use local file."""
- import mimetypes, mimetools, rfc822, StringIO
+ import mimetypes, mimetools, email.Utils, StringIO
host, file = splithost(url)
localname = url2pathname(file)
try:
@@ -418,7 +418,7 @@
except OSError, e:
raise IOError(e.errno, e.strerror, e.filename)
size = stats.st_size
- modified = rfc822.formatdate(stats.st_mtime)
+ modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
mtype = mimetypes.guess_type(url)[0]
headers = mimetools.Message(StringIO.StringIO(
'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- urllib2.py 31 Aug 2004 11:38:12 -0000 1.76
+++ urllib2.py 11 Oct 2004 13:53:07 -0000 1.77
@@ -99,7 +99,6 @@
import posixpath
import random
import re
-import rfc822
import sha
import socket
import sys
@@ -1129,12 +1128,13 @@
# not entirely sure what the rules are here
def open_local_file(self, req):
+ import email.Utils
host = req.get_host()
file = req.get_selector()
localfile = url2pathname(file)
stats = os.stat(localfile)
size = stats.st_size
- modified = rfc822.formatdate(stats.st_mtime)
+ modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
mtype = mimetypes.guess_type(file)[0]
headers = mimetools.Message(StringIO(
'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
More information about the Python-checkins
mailing list