From dbc92d136db0d677a2c8ea47e516b0410747c5a5 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 23 Nov 2014 16:02:23 +0100 Subject: [PATCH] Test if title is already unicode. --- sigal/settings.py | 4 ++-- tests/sample/sigal.conf.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sigal/settings.py b/sigal/settings.py index b47edc1..2272743 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -27,7 +27,7 @@ import os from os.path import abspath, isabs, join, normpath from pprint import pformat -from .compat import PY2 +from .compat import PY2, text_type _DEFAULT_CONFIG = { @@ -141,7 +141,7 @@ def read_settings(filename=None): if PY2 and isinstance(settings[p], str): settings[p] = settings[p].decode(enc) - if settings['title']: + if settings['title'] and not isinstance(settings['title'], text_type): settings['title'] = settings['title'].decode('utf8') for key in ('img_size', 'thumb_size', 'video_size'): diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index 6b27942..f5bdabb 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -title = "Sigal test gallery ☺" +title = u"Sigal test gallery ☺" source = 'pictures' thumb_suffix = '.tn' thumb_size = (200, 150)