Ab.の日記: trac tags plugin の utf-8 wiki ページ名対応
# make makepatch
/usr/bin/diff -ud ./tractags/macros.py.orig ./tractags/macros.py > /usr/ports/www/trac-tags/files/patch-tractags__macros.py
# cat files/patch-tractags__macros.py
--- ./tractags/macros.py.orig 2010-05-12 18:09:48.000000000 +0900
+++ ./tractags/macros.py 2010-05-12 18:28:30.000000000 +0900
@@ -76,8 +76,14 @@
resource, 'compact')
ul = builder.ul(class_='taglist')
+ def hooked_str(x):
+ try:
+ return str(x)
+ except UnicodeEncodeError:
+ pass
+ return str(x.encode('utf-8'))
for resource, tags in sorted(query_result,
- key=lambda r: str(r[0].id)):
+ key=lambda r: hooked_str(r[0].id)):
tags = sorted(tags)
if tags:
rendered_tags = [
r[0].id が str だったり int だったりしてそのまま x.encode とするわけに行かなかったのでこんな感じで。
trac tags plugin の utf-8 wiki ページ名対応 More ログイン