From 27b18c3fc645e69b27c4fe1ce6b0e3c3bfa58a10 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 7 Dec 2019 19:17:58 -0400 Subject: [PATCH] Update metaclass passing to work on Python 3 Fixes transformation labels in view titles. Signed-off-by: Roberto Rosario --- HISTORY.rst | 3 ++- mayan/apps/converter/transformations.py | 3 ++- mayan/apps/converter/views.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 5253009789..3a76214bf1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,7 +1,8 @@ 3.3.4 (2019-12-XX) ================== - Update the gunicorn worker class to synchronous. - +- Update the way the BaseTransformationType metaclass is passed + to work on Python 3. 3.3.3 (2019-12-05) ================== diff --git a/mayan/apps/converter/transformations.py b/mayan/apps/converter/transformations.py index 4c02599615..f2c4b1cee5 100644 --- a/mayan/apps/converter/transformations.py +++ b/mayan/apps/converter/transformations.py @@ -18,7 +18,7 @@ class BaseTransformationType(type): return force_text(self.label) -class BaseTransformation(object): +class BaseTransformation(object, metaclass=BaseTransformationType): """ Transformation can modify the appearance of the document's page preview. Some transformation available are: Rotate, zoom, resize and crop. @@ -27,6 +27,7 @@ class BaseTransformation(object): name = 'base_transformation' _layer_transformations = {} _registry = {} + # PY 2 __metaclass__ = BaseTransformationType @staticmethod diff --git a/mayan/apps/converter/views.py b/mayan/apps/converter/views.py index 7633a508c2..f03e7a576f 100644 --- a/mayan/apps/converter/views.py +++ b/mayan/apps/converter/views.py @@ -80,7 +80,7 @@ class TransformationCreateView( '"%(transformation)s" for: %(object)s' ) % { 'layer': self.layer, - 'transformation': self.get_transformation_class().label, + 'transformation': self.get_transformation_class(), 'object': self.external_object, } }