Search code examples
pythonpluginstrac

Trac plugin development: How to get access to trac.ini item from plugin


I have created a plugin which is working perfectly fine!

Now I need to get access to some value in trac.ini from that plugin

The plugin is implementing ITemplateStreamFilter

the method is def filter_stream(self, req, method, filename, stream, data):

How can I get value for some key in trac.ini from that method?


Solution

  • I think you could use Configuration class for this purpose config.py there implement get method:

     def get(self, section, key, default=''):
         return self[section].get(key, default)
    

    where section is section name in config file, and key is option.