[Erp5-report] r19845 - /erp5/trunk/products/ERP5OOo/OOoTemplate.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 13 13:59:29 CET 2008
Author: jerome
Date: Thu Mar 13 13:59:28 2008
New Revision: 19845
URL: http://svn.erp5.org?rev=19845&view=rev
Log:
If the image we are trying to use in office:include_img is not an Image, call
it and generate a temp image with the content. This works for methods returning
image content directly.
Modified:
erp5/trunk/products/ERP5OOo/OOoTemplate.py
Modified: erp5/trunk/products/ERP5OOo/OOoTemplate.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/OOoTemplate.py?rev=19845&r1=19844&r2=19845&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/OOoTemplate.py (original)
+++ erp5/trunk/products/ERP5OOo/OOoTemplate.py Thu Mar 13 13:59:28 2008
@@ -29,6 +29,7 @@
from types import StringType
from zLOG import LOG
from zLOG import PROBLEM
+from OFS.Image import File
from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.DirectoryView import registerFileExtension, registerMetaType
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
@@ -38,6 +39,7 @@
from urllib import quote
from Globals import InitializeClass, DTMLFile, get_request
from Globals import DevelopmentMode
+from Acquisition import aq_base
from AccessControl import ClassSecurityInfo
from OOoUtils import OOoBuilder
from zipfile import ZipFile, ZIP_DEFLATED
@@ -56,6 +58,7 @@
SUPPORTS_WEBDAV_LOCKS = 0
from Products.ERP5.Document.Document import ConversionError
+import Products.ERP5Type.Document
# Constructors
manage_addOOoTemplate = DTMLFile("dtml/OOoTemplate_add", globals())
@@ -344,8 +347,15 @@
# manipulations are different
is_standard_filetype = True
- if getattr(picture, 'data', None) is None \
- or callable(picture.content_type):
+ # If this is not a File, build a new file with this content
+ if not isinstance(picture, File):
+ tmp_picture = Products.ERP5Type.Document.newTempImage(
+ self, 'tmp')
+ tmp_picture.setData(picture())
+ picture = tmp_picture
+
+ if getattr(aq_base(picture), 'data', None) is None \
+ or callable(aq_base(picture).content_type):
is_standard_filetype = False
if is_standard_filetype:
More information about the Erp5-report
mailing list