]> granicus.if.org Git - python/commitdiff
use stat attributes instead of tuple entries
authorWalter Dörwald <walter@livinglogic.de>
Fri, 22 Mar 2002 17:30:38 +0000 (17:30 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Fri, 22 Mar 2002 17:30:38 +0000 (17:30 +0000)
and remove the unneccessary "import stat" statement.

Lib/urllib.py

index 0279749f88968c12ce352bc499e5fa06a6da4cbe..6faba77ee0cea456e6a1f1c03a2fcdac167c645c 100644 (file)
@@ -25,7 +25,6 @@ used to query various info about the object, if available.
 import string
 import socket
 import os
-import stat
 import time
 import sys
 import types
@@ -410,8 +409,8 @@ class URLopener:
         host, file = splithost(url)
         localname = url2pathname(file)
         stats = os.stat(localname)
-        size = stats[stat.ST_SIZE]
-        modified = rfc822.formatdate(stats[stat.ST_MTIME])
+        size = stats.st_size
+        modified = rfc822.formatdate(stats.st_mtime)
         mtype = mimetypes.guess_type(url)[0]
         headers = mimetools.Message(StringIO.StringIO(
             'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %