[Python-checkins] CVS: python/dist/src/Lib urllib2.py,1.25,1.26

Martin v. L?wis loewis@users.sourceforge.net
Mon, 18 Mar 2002 00:37:21 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv32346

Modified Files:
	urllib2.py 
Log Message:
Patch #525870: Avoid duplicate stat calls, use st_ attributes.


Index: urllib2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** urllib2.py	11 Feb 2002 20:46:10 -0000	1.25
--- urllib2.py	18 Mar 2002 08:37:19 -0000	1.26
***************
*** 103,107 ****
  import time
  import os
- import stat
  import gopherlib
  import posixpath
--- 103,106 ----
***************
*** 878,885 ****
          localfile = url2pathname(file)
          stats = os.stat(localfile)
!         size = stats[stat.ST_SIZE]
!         modified = rfc822.formatdate(stats[stat.ST_MTIME])
          mtype = mimetypes.guess_type(file)[0]
-         stats = os.stat(localfile)
          headers = mimetools.Message(StringIO(
              'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
--- 877,883 ----
          localfile = url2pathname(file)
          stats = os.stat(localfile)
!         size = stats.st_size
!         modified = rfc822.formatdate(stats.st_mtime)
          mtype = mimetypes.guess_type(file)[0]
          headers = mimetools.Message(StringIO(
              'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %