Nuxeo mailing list archives
[Nuxeo-tickets] [Nuxeo Repository] #1839: Creating images with
CPSDocument.createFile
Nuxeo Repository
trac at nuxeo.com
Mon Apr 30 12:06:15 CEST 2007
#1839: Creating images with CPSDocument.createFile
--------------------------+-------------------------------------------------
Reporter: tracguest | Owner: madarche
Type: enhancement | Status: new
Priority: P2 | Milestone: CPS 3.4.5
Component: CPS (global) | Version: TRUNK
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
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)
}}}
--
Ticket URL: <https://svn.nuxeo.org/trac/pub/ticket/1839>
Nuxeo Repository <http://www.cps-project.org/>
Nuxeo Repository
This list archive provided by Nuxeo, the
leaders of open source ECM.
Check out the Nuxeo 5 open source,
standards-based ECM project.