Edgewall Software

This page describes how to work with options or settings stored in trac.ini from your Plugin. Feel free to expand.

Trac plugins don't have access to some kind of global options. Options are only available for plugin components through the self.config property. This property is magically (i.e. implicitly) injected into component when it is created - see activation chapter for details. self.config is an instance of trac.config.Configuration class.

Get option value

trac.config.Configuration is a subclass of ConfigParser from standard Python library, therefore all its methods and more are accessible.

# inside component
self.config.get('section', 'option', 'default')
Last modified 7 years ago Last modified on Dec 17, 2010, 3:58:54 PM
Note: See TracWiki for help on using the wiki.