--- a/src/pyams_file/image.py Tue Feb 05 09:37:43 2019 +0100
+++ b/src/pyams_file/image.py Tue Feb 05 09:38:25 2019 +0100
@@ -19,11 +19,10 @@
from zope.interface import implementer
from zope.schema.fieldproperty import FieldProperty
+from pyams_file import _
from pyams_file.interfaces import IImage, IResponsiveImage, IThumbnailGeometry, IThumbnailer, IThumbnails
from pyams_utils.adapter import ContextAdapter, adapter_config
-from pyams_file import _
-
WEB_FORMATS = ('JPEG', 'PNG', 'GIF')
THUMB_SIZE = re.compile('^(?:\w+\:)?([0-9]+)x([0-9]+)$')
@@ -41,6 +40,15 @@
def __repr__(self):
return '<ThumbnailGeometry: x1,y1={0.x1},{0.y1} - x2,y2={0.x2},{0.y2}>'.format(self)
+ def __eq__(self, other):
+ if IThumbnailGeometry.providedBy(other):
+ return (self.x1 == other.x1) and \
+ (self.x2 == other.x2) and \
+ (self.y1 == other.y1) and \
+ (self.y2 == other.y2)
+ else:
+ return False
+
@adapter_config(context=IImage, provides=IThumbnailer)
class ImageThumbnailer(ContextAdapter):