Update metaclass passing to work on Python 3

Fixes transformation labels in view titles.

Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
Roberto Rosario
2019-12-07 19:17:58 -04:00
parent edf7a71931
commit 27b18c3fc6
3 changed files with 5 additions and 3 deletions

View File

@@ -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)
==================

View File

@@ -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

View File

@@ -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,
}
}