display_list must return str, not unicode

This commit is contained in:
Emmanuel Garette 2017-02-03 15:56:00 +01:00
parent 3e352e3b41
commit fe379abb42
1 changed files with 4 additions and 1 deletions

View File

@ -26,7 +26,10 @@ def display_list(lst, separator='and'):
if len(lst) == 0: if len(lst) == 0:
return '' return ''
elif len(lst) == 1: elif len(lst) == 1:
return lst[0] ret = lst[0]
if isinstance(ret, unicode):
ret = ret.encode('utf8')
return ret
else: else:
lst_ = [] lst_ = []
for l in lst[:-1]: for l in lst[:-1]: