projects
/
matthijs
/
projects
/
xerxes.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e42f0a6
)
Use force_unicode() instead of .__unicode__().
author
Matthijs Kooijman
<matthijs@stdin.nl>
Sat, 31 Jan 2009 13:19:57 +0000
(14:19 +0100)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Sat, 31 Jan 2009 13:19:57 +0000
(14:19 +0100)
This allows the natural_list template tag to work for unicode strings as
well, which have no __unicode__() method.
tools/templatetags/list.py
patch
|
blob
|
history
diff --git
a/tools/templatetags/list.py
b/tools/templatetags/list.py
index 70ce860d978a0d03c83775ac5c4192e486f3cfa3..87d797684e1deebbc7e36a55bf5e2708fe598d20 100644
(file)
--- 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