From b0582536b7f478933557c1adfc856913dd25bc0a Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Thu, 24 Mar 2011 17:05:21 +0000
Subject: [PATCH] filename argument is understood as original filename by
 portal_transforms. Give original filename instead of converted filename, to
 not confuse transforms behind portal_transforms.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@44584 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Image.py        | 2 +-
 product/ERP5/Document/PDFDocument.py  | 2 +-
 product/ERP5/Document/TextDocument.py | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py
index aa567e9df0..e75536054c 100644
--- a/product/ERP5/Document/Image.py
+++ b/product/ERP5/Document/Image.py
@@ -247,7 +247,7 @@ class Image(TextConvertableMixin, File, OFSImage):
     portal_transforms = portal.portal_transforms
     result = portal_transforms.convertToData(mime_type, content,
                                              object=self, context=self,
-                                             filename=self.getTitleOrId(),
+                                             filename=self.getFilename(),
                                              mimetype=src_mimetype)
     if result is None:
       # portal_transforms fails to convert.
diff --git a/product/ERP5/Document/PDFDocument.py b/product/ERP5/Document/PDFDocument.py
index e9b0eeb86b..bbb52c748a 100644
--- a/product/ERP5/Document/PDFDocument.py
+++ b/product/ERP5/Document/PDFDocument.py
@@ -123,7 +123,7 @@ class PDFDocument(Image):
       return ''
     mime_type = 'text/plain'
     portal_transforms = self.getPortalObject().portal_transforms
-    filename = self.getStandardFilename(format='txt')
+    filename = self.getFilename()
     result = portal_transforms.convertToData(mime_type, str(self.getData()),
                                              context=self, filename=filename,
                                              mimetype=self.getContentType())
diff --git a/product/ERP5/Document/TextDocument.py b/product/ERP5/Document/TextDocument.py
index 5d457f474f..7446507f06 100644
--- a/product/ERP5/Document/TextDocument.py
+++ b/product/ERP5/Document/TextDocument.py
@@ -155,7 +155,7 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
           kw['charset'] = convert_kw['encoding'] = charset
         if not self.hasConversion(**kw):
           portal_transforms = portal.portal_transforms
-          filename = self.getStandardFilename(format=format)
+          filename = self.getFilename()
           if mime_type == 'text/html':
             mime_type = 'text/x-html-safe'
           result = portal_transforms.convertToData(mime_type, text_content,
-- 
2.30.9