Nuxeo mailing list archives
[CPS-devel] possible improvement for CPSDocument.createFile
Florent Guillaume
fg at nuxeo.com
Sat Apr 28 20:45:18 CEST 2007
Hi,
If you don't mind, could you put this in a new issue in the
bugtracker? Otherwise it might get lost, and the bugtracker is where
issue management happens.
Thanks,
Florent
On 12 Apr 2007, at 16:33, Michael Schulz wrote:
>
> Hi Florent, Jose,
>
> I am also looking at this file for a while and found that it always
> creates
> files, even if you upload images, a zope file object is created.
>
> This is the corresponding patch, to the createFile.py of cps 3.4.3,
> without
> jose's patch:
>
> ============
> --- ../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)
> ==========
>
> Cheers, Michael
>
> -----------------------------
> Michael Schulz
>
> in medias res GmbH
> In den Weihermatten 66
> D-79108 Freiburg
> +49 761 5569595
>
>
--
Florent Guillaume, Director of R&D, Nuxeo
Open Source Enterprise Content Management (ECM)
http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
This list archive provided by Nuxeo, the
leaders of open source ECM.
Check out the Nuxeo 5 open source,
standards-based ECM project.