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