From 16ae4b34ca9c6abdd5236869c7d479ebc8a498ef Mon Sep 17 00:00:00 2001 From: Mateusz Marzantowicz Date: Tue, 29 Jul 2014 14:47:40 +0200 Subject: [PATCH] Fixed: TypeError: initial_value must be str or None, not bytes --- djangocms_text_ckeditor/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/djangocms_text_ckeditor/html.py b/djangocms_text_ckeditor/html.py index 4dfea0a..ec66682 100644 --- a/djangocms_text_ckeditor/html.py +++ b/djangocms_text_ckeditor/html.py @@ -6,7 +6,7 @@ from PIL import Image import re import uuid -from django.utils.six import StringIO +from django.utils.six import BytesIO from .settings import (TEXT_SAVE_IMAGE_FUNCTION, TEXT_ADDITIONAL_TAGS, TEXT_ADDITIONAL_ATTRIBUTES, TEXT_HTML_SANITIZE) @@ -90,7 +90,7 @@ def extract_images(data, plugin): except IndexError: # No image type specified -- will convert to jpg below if it's valid image data image_type = "" - image = StringIO(image_data) + image = BytesIO(image_data) # genarate filename and normalize image format if image_type == "jpg" or image_type == "jpeg": file_ending = "jpg" @@ -101,7 +101,7 @@ def extract_images(data, plugin): else: # any not "web-safe" image format we try to convert to jpg im = Image.open(image) - new_image = StringIO() + new_image = BytesIO() file_ending = "jpg" im.save(new_image, "JPEG") new_image.seek(0)