[Zope3-checkins] CVS: Zope3/src/zope/app/publisher - fileresource.py:1.4

Jeremy Hylton cvs-admin at zope.org
Mon Nov 3 23:04:57 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/publisher
In directory cvs.zope.org:/tmp/cvs-serv28992/src/zope/app/publisher

Modified Files:
	fileresource.py 
Log Message:
Fix various import issues.

Some names where from imported twice.
Other imports were unused.
Often imports were in partly random order, making them harder to read.


=== Zope3/src/zope/app/publisher/fileresource.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/publisher/fileresource.py:1.3	Thu May  1 15:35:27 2003
+++ Zope3/src/zope/app/publisher/fileresource.py	Mon Nov  3 23:04:26 2003
@@ -15,35 +15,30 @@
 
 $Id$
 """
-__metaclass__ = type # All classes are new style when run with Python 2.2+
-
-
 from zope.app.content_types import guess_content_type
 from zope.app.datetimeutils import rfc1123_date
 from time import time
-from os import stat
 import os
 
-class File:
-    """Image objects stored in external files."""
-
+class File(object):
+    
     def __init__(self, path):
+        self.path = path
 
-        self.path=path
-
-        file=open(path, 'rb')
-        data=file.read()
-        file.close()
+        f = open(path, 'rb')
+        data = f.read()
+        f.close()
         self.content_type, enc = guess_content_type(path, data)
-        self.__name__=path[path.rfind('/')+1:]
-        self.lmt=float(stat(path)[8]) or time()
-        self.lmh=rfc1123_date(self.lmt)
+        self.__name__ = path[path.rfind('/') + 1:]
+        self.lmt = float(os.stat(path)[8]) or time()
+        self.lmh = rfc1123_date(self.lmt)
 
 class Image(File):
+    """Image objects stored in external files."""
 
     def __init__(self, path):
         super(Image, self).__init__(path)
-        if self.content_type in (None,  'application/octet-stream'):
+        if self.content_type in (None, 'application/octet-stream'):
             ext = os.path.splitext(self.path)[1]
             if ext:
-                self.content_type='image/%s' % ext[1:]
+                self.content_type = 'image/%s' % ext[1:]




More information about the Zope3-Checkins mailing list