Fix unicode no more exist on py3.

This commit is contained in:
Simon Conseil
2014-09-27 00:43:37 +02:00
parent a0ed5d88ff
commit 81d898040c

View File

@@ -39,7 +39,7 @@ from os.path import isfile, join, splitext
from PIL import Image as PILImage
from . import image, video, signals
from .compat import UnicodeMixin, strxfrm, url_quote
from .compat import UnicodeMixin, strxfrm, url_quote, text_type
from .image import process_image, get_exif_tags, get_exif_data
from .settings import get_thumb
from .utils import (Devnull, copy, check_or_create_dir, url_from_path,
@@ -550,7 +550,7 @@ class Gallery(object):
# 63 is the total length of progressbar, label, percentage, etc
available_length = get_terminal_size()[0] - 64
if x and available_length > 10:
return unicode(x.name)[:available_length].encode('utf-8')
return text_type(x.name)[:available_length].encode('utf-8')
else:
return ""