[Erp5-report] r43335 ivan - in /erp5/trunk/products/ERP5: Document/ mixin/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 15 09:17:00 CET 2011
Author: ivan
Date: Tue Feb 15 09:17:00 2011
New Revision: 43335
URL: http://svn.erp5.org?rev=43335&view=rev
Log:
Downloadables should accept 'display', 'quality', 'resolution', 'frame' (it's job of implementation to honour or not them). Resize image produced from Web Page to Image conversion.
Modified:
erp5/trunk/products/ERP5/Document/TextDocument.py
erp5/trunk/products/ERP5/mixin/downloadable.py
Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=43335&r1=43334&r2=43335&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py [utf8] Tue Feb 15 09:17:00 2011
@@ -36,6 +36,8 @@ from Products.ERP5.Document.Document imp
from Products.ERP5.Document.File import File
from Products.ERP5Type.WebDAVSupport import TextContent
import re
+from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST
+import cStringIO
# Mixin Import
from Products.ERP5.mixin.cached_convertable import CachedConvertableMixin
@@ -166,6 +168,16 @@ class TextDocument(CachedConvertableMixi
'portal_transforms failed to convert '
'from %r to %s: %r' %
(src_mimetype, mime_type, self))
+
+ if format in VALID_IMAGE_FORMAT_LIST:
+ # do resize by temporary image
+ temp_image = self.portal_contributions.newContent(
+ portal_type='Image',
+ file=cStringIO.StringIO(),
+ filename=self.getId(),
+ temp_object=1)
+ temp_image._setData(result)
+ mime, result = temp_image.convert(**kw)
self.setConversion(result, original_mime_type, **kw)
else:
mime_type, result = self.getConversion(**kw)
Modified: erp5/trunk/products/ERP5/mixin/downloadable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/downloadable.py?rev=43335&r1=43334&r2=43335&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/downloadable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/downloadable.py [utf8] Tue Feb 15 09:17:00 2011
@@ -40,7 +40,7 @@ class DownloadableMixin:
### Content processing methods
security.declareProtected(Permissions.View, 'index_html')
- @fill_args_from_request
+ @fill_args_from_request('display', 'quality', 'resolution', 'frame')
def index_html(self, REQUEST, RESPONSE, format=_MARKER, **kw):
"""
We follow here the standard Zope API for files and images
More information about the Erp5-report
mailing list