Opened 17 years ago
Last modified 16 years ago
#5651 closed defect
[patch] Use 'inherit' 'file' config setting when creating a new Environment (not loading defaults) — at Initial Version
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | general | Version: | devel |
Severity: | normal | Keywords: | environment inherit |
Cc: | Christian Boos, shepting@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
As I have started upgrading my code from 0.10 to 0.11 I have found this problem: My automated project creation now gives me new projects with 168 lines of default config options - whereas current setup with 0.10 I have only a few as the rest being inherited from global trac.ini.
The problem is obviously that there is no longer any trac.siteconfig that allows us to fetch a reference to any global trac.ini. The current mechanism is [inherit] file = ...
in project trac.ini.
However, passing options = [('inherit', 'file', '/path/to/global/trac.ini'),]
to Environment('/path/to/project', create=True, options)
does not make a difference - current code loads all defaults, then add the line to the config options as any other setting. For any other setting that is likely an OK approach (as it overwrites defaults), but for file inheritance it is not as any inherited setting will now be overridden by defaults regardless.
Enclosed is a patch that:
- Does not load defaults if options are passed to Environment create, and one of those options is
('inherit', 'file')
. - If inherit-file option, it also fully reloads the config after options have been written to file, as the 'inherit' will then be processed as well.
- Fixes environment created routine in workflow that assumes that settings never exists if it is a new project. The patch for workflow should be applied regardless, as if if an environment is created by passing in a custom workflow as options to create, the workflow routine will actually overwrite parts of that config - whatever lines it can match with own defaults… You get part custom, and part default - nice :-)
Patch that makes Environment.create(options) behave better if
[inherit] file = ...
if it is passed in as option.