[PATCH] macro config=xxx argument, trac.ini option lookup with inheritance
|Reported by:||Patrick Schaaf||Owned by:||Chris Nelson|
|Cc:||Ryan J Ollos||Trac Release:||0.11|
As discussed shortly in #8704, here is a patch providing inheritable option lookup and defaulting.
NOTE: depends on the newly created TracMacroConfigPlugin. I'm unsure whether that dependency can somehow be handled automatically in setup.py - there seem to be some options related to that, but I have not yet played with them.
With this patch applied, the configuration can contain something like this:
[trac-jsgantt] option.inherit = base base.userMap = 0 base.omitMilestones = 1 base.dateDisplay = yyyy-mm-dd mini.inherit = base mini.startDate = 0 mini.endDate = 0 mini.res = 0 mini.dur = 0 mini.comp = 0 mini.lwidth = 256
A macro call with only TracQuery arguments, or other but not all macro arguments, will then take its full option list from the option.xxx option set, which immediately inherits them all from base.xxx for the sake of exposition.
Additionally, a macro call written as
[[TracJSGanttChart(config=mini)]], will take its options from the mini.xxx settings (which also inherit some from base.xxx)
It is even possible to write something like
to get multiple inheritance from mini.xxx, and from foobar.xxx when missing from the mini. path. Such multiple inheritance is also supported within trac.ini for the xxx.inherit = a|b options.
(tested under 0.11.7 and 0.12.2)