忍者ブログ
想いとグチの吐き出し場

ReportIncludePluginもカスタマイズする@trac (Trac1.0ja版)

TracにReportIncludePluginというプラグインがある。
ざっくり言うと、チケットレポートの表やグラフをwikiに組み込めるプラグイン。

このプラグインもフルネーム表示問題時刻問題がある。

というわけで対応していこう。

環境は前々記事と同じ
ReportIncludePluginのバージョンは0.5-SNAPSHOT。
注意事項も前々記事と同じ。
 自分はTracの製作者等ではなく、単なる1ユーザーでしかありません。
 ソースの改変によるいかなる損失・被害等にも対応しませんし
 動作保証すらしていません。
 もしこの記事を読んでソースの改変を行う時は
 自己責任でお願いします。





対象ファイル:reportincludeplugin/reportinclude/renderer.py
改変内容:フルネーム表示も時刻表示もまとめて対応。

16,21d15
< # Get Name of all known users
< self.db = self.env.get_db_cnx()
< self.name_map = {}
< for username, name, email in self.env.get_known_users(self.db):
< if name:
< self.name_map[username] = name
296,298c290,292
< col = col != None and format_time(t=int(col), format='%H:%M:%S') or '--'
< if column in ('date', 'created', 'modified') or column.endswith(u'日付') or column.endswith(u'日'):
< col = col != None and format_date(t=int(col), format='%Y/%m/%d') or '--'
---
> col = col != None and format_time(int(col)) or '--'
> if column in ('date', 'created', 'modified') or column.endswith(u'日付'):
> col = col != None and format_date(int(col)) or '--'
300c294
< col = col != None and format_datetime(t=int(col), format='%Y/%m/%d %H:%M:%S') or '--'
---
> col = col != None and format_datetime(int(col)) or '--'
302,306d295
< if column == 'owner' or column == u'担当者':
< col = col != None and self.name_map[col] or '--'
< if column == 'reporter' or column == u'報告者':
< col = col != None and self.name_map[col] or '--'
<
PR