Help Macros and Plugins with trac.ini lookup and defaulting


This module provides a helper class which can be used by other plugins, especially macros, in retrieving optional arguments from the trac.ini configuration file. By itself, this modules does not provide any functionality.

A macro using this module, can be called with a config=xxx option, to retrieve a set of options which in trac.ini all start with prefix xxx.

Inheritance is supported, by writing an option xxx.inherit = yyy in trac.ini - all macro options not yet determined, are then searched with the other prefix, yyy.

Multiple inheritance is supported, by writing config=prefixA|prefixB in the macro invocation, or writing an xxx.inherit = prefixC|prefixD option in trac.ini.

The macro module which uses this functionality, specifies a list of expected options, as well as their defaults. These defaults will then be used when the respective option is not specified anywhere.

Bugs/Feature Requests

Existing bugs and feature requests for TracMacroConfigPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from here.


You can check out TracMacroConfigPlugin from here using Subversion, or browse the source with Trac.


General instructions on installing Trac plugins can be found on the TracPlugins page.


Currently no plugin or macro uses the functionality. There is an file included in the distribution, which when enabled through the admin plugings interface, provides a macro named TracMacroConfigExample, which displays a table detailing interesting things about concrete option lookups. This allows you to play with macro arguments and in a corresponding [macroconfig-example] section in trac.ini and to play with inheritance setups.

This is how exemplary calls to that macro would be written in a wiki page:

[[TracMacroConfigExample(config=class-c, extra=more stuff)]] 

Use this together with a trac.ini section like this:

class-a.bool = True 
class-a.text = A Text 
class-b.bool = False = 73 
class-c.config = class-a|class-b 
class-c.list = knees|toes 

Recent Changes

11435 by bof on 2012-03-28 09:02:13
remember non-keyword macro args, provide list() method to retrieve them.
10586 by bof on 2011-08-11 12:09:54
optional options() method parameter result=, possible values 'all' (default, as before), 'wellknown' (only return registered options), 'extra' (only return extra options), or 'nothing' (do not return anything)
10568 by bof on 2011-08-08 11:41:07 fix


Author: bof
Maintainer: Patrick Schaaf
Contributors: Yalwa Branchenbuch (sponsor)

Last modified 6 years ago Last modified on Dec 8, 2015, 6:29:40 AM