From: Matthijs Kooijman Date: Sat, 31 Jan 2009 13:19:57 +0000 (+0100) Subject: Use force_unicode() instead of .__unicode__(). X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fxerxes.git;a=commitdiff_plain;h=926e20fad179f5bf6a1ddf4e2fdbc672c175a7af Use force_unicode() instead of .__unicode__(). This allows the natural_list template tag to work for unicode strings as well, which have no __unicode__() method. --- diff --git a/tools/templatetags/list.py b/tools/templatetags/list.py index 70ce860..87d7976 100644 --- a/tools/templatetags/list.py +++ b/tools/templatetags/list.py @@ -43,12 +43,12 @@ def natural_list(list): for item in list[0:-1]: if res: res += ', ' - res += item.__unicode__() + res += force_unicode(item) if res: res += ' %s ' % _('and') - res += list[-1].__unicode__() + res += force_unicode(list[-1]) return res natural_list.is_safe = True