Use BytesIO instead of StringIO. Use text_type instead of unicode.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import base64
|
||||
from io import BytesIO
|
||||
import logging
|
||||
import os
|
||||
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
from PIL import Image, ImageFilter
|
||||
import sh
|
||||
import yaml
|
||||
|
||||
from django.utils.six import text_type
|
||||
from django.utils.translation import string_concat, ugettext_lazy as _
|
||||
|
||||
from common.settings import setting_temporary_directory
|
||||
@@ -193,7 +190,7 @@ class ConverterBase(object):
|
||||
if not self.image:
|
||||
self.seek(0)
|
||||
|
||||
image_buffer = StringIO()
|
||||
image_buffer = BytesIO()
|
||||
new_mode = self.image.mode
|
||||
|
||||
if output_format.upper() == 'JPEG':
|
||||
@@ -296,7 +293,7 @@ class BaseTransformation(object):
|
||||
self.kwargs[argument_name] = kwargs.get(argument_name)
|
||||
|
||||
def cache_hash(self):
|
||||
result = unicode.__hash__(self.name)
|
||||
result = text_type.__hash__(self.name)
|
||||
for index, (key, value) in enumerate(self.kwargs.items()):
|
||||
result ^= hash((key, index)) ^ hash((value, index))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user