Add transformation metaclass in a way compatible
Use Django's with_metaclass to Work with Python 2 and Python 3. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -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)
|
||||
==================
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user