Commit d6f27bd7 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Minimal level of compatibility provided with old Image class. Once an Image is...

Minimal level of compatibility provided with old Image class. Once an Image is viewed, it is upgraded.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11826 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 95e4c0e4
......@@ -30,6 +30,7 @@
##############################################################################
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
......@@ -251,6 +252,16 @@ class Image(File, OFSImage, ConversionCacheMixin):
def index_html(self, REQUEST, RESPONSE, display=None, format='', quality=75, resolution=None):
"""Return the image data."""
# Quick hack to maintain just enough compatibility for existing sites
# Convert to new BTreeFolder2 based class
if getattr(aq_base(self), '_count', None) is None:
self._initBTrees()
# Make sure old Image objects can still be accessed
if not hasattr(aq_base(self), 'data') and hasattr(self, '_original'):
self.data = self._original.data
self.height = self._original.height
self.width = self._original.width
# display may be set from a cookie (?)
if (display is not None or resolution is not None or quality != 75) and defaultdisplays.has_key(display):
if not self.hasConversion(display=display, format=format,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment