diff --git a/HISTORY.rst b/HISTORY.rst index 5520f52b9c..0a5752805d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -18,6 +18,8 @@ - Use TemplateField for the web link template. - Use TemplateField for smart links. - Add the ID and the URL to the checkout serializer. +- Add BaseTransformationType metaclass in a way compatible with + Python 2 and Python 3. 3.3.4 (2019-12-09) ================== diff --git a/mayan/apps/converter/transformations.py b/mayan/apps/converter/transformations.py index f2c4b1cee5..0d6520d31f 100644 --- a/mayan/apps/converter/transformations.py +++ b/mayan/apps/converter/transformations.py @@ -6,6 +6,7 @@ import logging from PIL import Image, ImageColor, ImageDraw, ImageFilter from django.utils.encoding import force_bytes, force_text +from django.utils.six import with_metaclass from django.utils.translation import string_concat, ugettext_lazy as _ from .layers import layer_saved_transformations @@ -18,7 +19,7 @@ class BaseTransformationType(type): return force_text(self.label) -class BaseTransformation(object, metaclass=BaseTransformationType): +class BaseTransformation(with_metaclass(meta=BaseTransformationType)): """ Transformation can modify the appearance of the document's page preview. Some transformation available are: Rotate, zoom, resize and crop. @@ -27,8 +28,6 @@ class BaseTransformation(object, metaclass=BaseTransformationType): name = 'base_transformation' _layer_transformations = {} _registry = {} - # PY 2 - __metaclass__ = BaseTransformationType @staticmethod def combine(transformations):