Noah Kantrowitz wrote: > Phil Schumm wrote: > >> I'm working on my first plugin, and want to be able to use a >> dedicated section in trac.ini to specify certain options. I know >> that I can simply add a new section and items to trac.ini and then >> retrieve the values with something like: >> >> objectname.config.get() >> >> however it looks like I should also be declaring my options using the >> classes Option, BoolOption, etc. defined in config.py. I've read >> through some of the source and the online developer documentation, >> but I don't yet have a good understanding of when and how these >> classes should be used. Can anyone shed any light on this or point >> me toward a document or thread which discusses this issue? >> >> > The main difference is that the descriptor classes (Option, etc) have a > registry system behind the scenes. This is what enabled the TracIni > macro, and the IniAdmin plugin. If possible use the descriptor classes, > but in some cases you need to access the options dynamically. In this > case use a similar approach to the SMTP settings in trac.notification, > make a dummy plugin that has descriptors for each option (to make them > show up in things using the Option registry), and then use > self.config['section']['option'] in your code. > PS: If you have questions about plugin development and it is between 10AM and 12AM GMT-5 (roughly, my sleep schedule is erratic to say the least), feel free to drop by #trac and ask.
--Noah
signature.asc
Description: OpenPGP digital signature
