Commit a5c87f16 authored by Jérome Perrin's avatar Jérome Perrin

Image: prevent useless object modification when self.data has 0 length

parent 99de00d9
......@@ -150,9 +150,9 @@ class Image(TextConvertableMixin, File, OFSImage):
self.data = self._data
# Make sure size is defined
if (not hasattr(aq_base(self), 'size') or not self.size) and \
hasattr(aq_base(self), 'data'):
self.size = len(self.data)
size = len(self.data)
if getattr(aq_base(self), 'size', None) != size:
self.size = size
security.declareProtected(Permissions.AccessContentsInformation, 'getWidth')
def getWidth(self):
......
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