createFile.py always creates Zope file objects, even if you upload images, a zope file object is created. This patch creates image objects (the diff comes from CPS Version 3.4.3):
--- ../Products-CPS-platform-3.4.3/CPSDocument/createFile.py 2007-04-10
10:52:10.000000000 +0200
+++ createFile.py 2007-04-12 14:07:08.000000000 +0200
@@ -25,7 +25,7 @@
from logging import getLogger
from Products.CMFCore.utils import getToolByName
-from OFS.Image import File
+from OFS.Image import File, Image
from AccessControl import ModuleSecurityInfo
from zipfile import ZipFile, BadZipfile
from StringIO import StringIO
@@ -107,7 +107,10 @@
# create file to attach to document
data = zipfile.read(path)
- file_to_attach = File(path_filename, path_filename, data)
+ if ptype in ['Image']:
+ file_to_attach = Image(path_filename, path_filename, data)
+ else:
+ file_to_attach = File(path_filename, path_filename, data)
if mimetype and file_to_attach.content_type != mimetype:
logger.debug('Fixing mimetype from %s to %s',
file_to_attach.content_type, mimetype)