Opened 13 years ago
Last modified 5 years ago
#8979 new enhancement
[PATCH] macro config=xxx argument, trac.ini option lookup with inheritance
Reported by: | Patrick Schaaf | Owned by: | Chris Nelson |
---|---|---|---|
Priority: | normal | Component: | TracJsGanttPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
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 [[TracJSGanttChart(config=mini|foobar)]]
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)
Attachments (5)
Change History (8)
Changed 13 years ago by
Attachment: | tracjsganttplugin-macroconfig-c10414.patch added |
---|
comment:1 Changed 13 years ago by
Replying to bof:
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.
The TracHoursPlugin handles the dependencies automatically. You might take a look at its setup.py
. Another option is to add a simple install_requires
to setup.py
.
Changed 13 years ago by
Attachment: | tracjsganttplugin-macroconfig-setup-c10414.patch added |
---|
additional patch, against setup.py, to automatically install the dependency. thx rjollos for the example.
Changed 13 years ago by
Attachment: | tracjsganttplugin-macroconfig-c10480.patch added |
---|
combined and updated patch, includes new goal option
Changed 13 years ago by
Attachment: | tracjsganttplugin-macroconfig-c10568.patch added |
---|
refreshed patch, now using TracMacroConfigPlugin descriptor options
comment:2 Changed 13 years ago by
Cc: | Ryan J Ollos added; anonymous removed |
---|
The refreshed patch (c10568), part from modifying how the macro options are looked up, contains one functional enhancement:
Both the root= and goal= options can now contain self among a list of IDs, e.g. "root=1234|self|5435". While cleaning this up, I took the liberty to factor the duplicated code handling root and gool, into a new local function _addin.
Changed 13 years ago by
Attachment: | tracjsganttplugin-0.9r10710_c10568patched.tar.gz added |
---|
comment:3 Changed 5 years ago by
Cc: | Ryan J Ollos removed |
---|
make use of TracMacroConfigPlugin for inheritable macro option defaults