[Zope3-checkins] CVS: Zope3/src/zope/app/file - image.py:1.1.2.2

Philipp von Weitershausen philikon at philikon.de
Mon Feb 23 05:49:31 EST 2004


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

Modified Files:
      Tag: philikon-movecontent-branch
	image.py 
Log Message:
Cleanup.


=== Zope3/src/zope/app/file/image.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/file/image.py:1.1.2.1	Fri Feb 20 14:39:47 2004
+++ Zope3/src/zope/app/file/image.py	Mon Feb 23 05:49:30 2004
@@ -51,9 +51,7 @@
     data = property(File.getData, setData, None,
                     """Contains the data of the file.""")
 
-
 class ImageSized:
-
     implements(ISized)
 
     def __init__(self, image):
@@ -78,6 +76,21 @@
         size.mapping = mapping 
         return size
 
+class FileFactory:
+
+    def __init__(self, context):
+        self.context = context
+
+    def __call__(self, name, content_type, data):
+        if not content_type and data:
+            content_type, width, height = getImageInfo(data)
+        if not content_type:
+            content_type, encoding = guess_content_type(name, data, '')
+
+        if content_type.startswith('image/'):
+            return Image(data)
+
+        return File(data, content_type)
 
 def getImageInfo(data):
     data = str(data)
@@ -137,20 +150,3 @@
             pass
 
     return content_type, width, height
-
-
-class FileFactory:
-
-    def __init__(self, context):
-        self.context = context
-
-    def __call__(self, name, content_type, data):
-        if not content_type and data:
-            content_type, width, height = getImageInfo(data)
-        if not content_type:
-            content_type, encoding = guess_content_type(name, data, '')
-
-        if content_type.startswith('image/'):
-            return Image(data)
-
-        return File(data, content_type)




More information about the Zope3-Checkins mailing list