Hide
Easily highlight source code for your blog with our Syntax Highlighter. Join Siafoo Now or Learn More

Patch Trac to allow arbitrary project properties Atom Feed 0

In Brief Using this patch you can specify a [project_info] stanza in your trac.ini file, and everything in that stanza will be passed to your project listing template as key-value pairs under project.info.... more
# 's
 1Index: trac/env.py
2===================================================================
3--- trac/env.py (revision 7941)
4+++ trac/env.py (working copy)
5@@ -195,6 +195,10 @@
6 ('setuptools', setuptools.__version__),
7 ]
8 self._href = self._abs_href = None
9+
10+ self.project_info = dict(self.config.options('project_info'))
11
12 from trac.loader import load_components
13 plugins_dir = self.config.get('inherit', 'plugins_dir')
14Index: trac/web/main.py
15===================================================================
16--- trac/web/main.py (revision 7941)
17+++ trac/web/main.py (working copy)
18@@ -550,10 +550,11 @@
19 proj = {
20 'name': env.project_name,
21 'description': env.project_description,
22- 'href': href(env_name)
23+ 'href': href(env_name),
24+ 'info': env.project_info
25 }
26 except Exception, e:
27- proj = {'name': env_name, 'description': to_unicode(e)}
28+ proj = {'name': env_name, 'description': to_unicode(e), 'info': {}}
29 projects.append(proj)
30 projects.sort(lambda x, y: cmp(x['name'].lower(), y['name'].lower()))
31

Using this patch you can specify a [project_info] stanza in your trac.ini file, and everything in that stanza will be passed to your project listing template as key-value pairs under project.info.

See http://trac-hacks.org/wiki/ArbitraryProjectPropertiesPatch for more information.

You can also do this within each project.