#11520 closed defect (fixed)
Some options are not written to trac.ini on environment creation
Reported by: | Ryan J Ollos | Owned by: | Jun Omae |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.6 |
Component: | general | Version: | 1.0-stable |
Severity: | normal | Keywords: | config |
Cc: | Jun Omae | Branch: | |
Release Notes: |
Option defaults in |
||
API Changes: | |||
Internal Changes: |
Description (last modified by )
It appears that the default values for all of the options should be written to trac.ini when the environment is created. However, I noticed that some are missing. Looking at just the [trac]
section, the following are missing:
default_date_format
default_handler
default_language
default_timezone
request_filters
use_xsendfile
All of those options are contained in the trac.web.main.RequestDispatcher
class.
Attachments (0)
Change History (11)
comment:1 by , 11 years ago
follow-up: 3 comment:2 by , 11 years ago
Milestone: | next-stable-1.0.x → 1.0.2 |
---|
You fix the issues faster than I can report them :)
I tried your change and it works well, except I don't see the request_filter
entry. I compared all of the other options in trac.ini to what is presented with the TracIni macro and found the following omissions:
[logging] log_format
[search] default_disabled_filters
[sqlite] extensions
The commonality among those 3 options is that the default value is None
. Also the default for request_filters
is None
.
[svn]
and [git]
sections are missing, but I think that is due to #11437 (components were not enabled when environment was created).
comment:3 by , 11 years ago
The commonality among those 3 options is that the default value is
None
. Also the default forrequest_filters
isNone
.
[f59bb4f6/jomae.git] would write option-name =
instead of # option-name = <inherited>
for these options. After the changes, # option-name = <inherited>
never be appear in trac.ini even if --inherit
option of initenv.
[svn]
and[git]
sections are missing, but I think that is due to #11437 (components were not enabled when environment was created).
Oh, I hadn't noticed it. [b58247ccb/jomae.git] would fix it. Also see comment of tags/trac-1.0.1/trac/config.py@:158-159#L154 about removing self
from set_defaults(self)
.
comment:4 by , 11 years ago
Cc: | added |
---|
I found the same issue as #11074 in trac.ini.sample
.
$ grep colors conf/trac.ini.sample graph_colors = ['#cc0', '#0c0', '#0cc', '#00c', '#c0c', '#c00']
follow-up: 6 comment:5 by , 11 years ago
Thanks for the hints in comment:3. They might be useful for solving #11437. Maybe we can call Configuration.set_defaults()
and Configuration.save()
when enabling components. If that was done, then it might not be a problem to write the configuration for only the components that are enabled (maybe even preferable since we wouldn't have configuration sections for components that have never been enabled?).
Now I see additionally the [authz_policy]
, [git]
and [svn]
sections in trac.ini, as well as the options that were previously missing.
If I define [inherit] file
with contents:
[logging] log_level = DEBUG
pressing Apply changes from the Logging admin page results in the trac.ini file being rewritten with log_level
omitted. Looking at the code I'm not sure why the entry is omitted, though the behavior seems fine. I was trying to determine if this code is ever called after your changes: branches/1.0-stable/trac/config.py@12430:251-252#L242.
comment:6 by , 11 years ago
Looking at the code I'm not sure why the entry is omitted, though the behavior seems fine. I was trying to determine if this code is ever called after your changes: branches/1.0-stable/trac/config.py@12430:251-252#L242.
Currently (also after the changes), if [inherit] file
is used and option's value is equal the inherited value, the option is omitted and # name = <inherited>
is not written in trac.ini. That is in Configuration.save()
at tags/trac-1.0.1/trac/config.py@:222-224,230#L210.
comment:7 by , 11 years ago
On a default installation, I get the following:
$ trac-admin ../tracdev config get trac default_handler Error: Option 'default_handler' doesn't exist in section 'trac'
The reason that surprised me is that I thought the default value would be retrieved if the option was not defined in trac.ini.
Anyway, the reason I mention is that the following line should be removed from the changes in [12573] when the changes in this ticket are committed:
# Remove after change in #11520 is committed self._testenv.set_config('trac', 'default_handler', 'WikiModule')
comment:8 by , 11 years ago
I found that if option key was not a unicode string, then # option = <inherited>
would still be written to the file if config[section].set('option', None)
was called.
I've also pulled in your changes from #11437 and tested. I removed [b58247ccb/jomae.git] after pulling in [ab2c9ca8/jomae.git], since it seems better to only write sections for components that are enabled.
To summarize the proposed behaviors:
- Write all options to trac.ini when there is no parent (inherited) file.
- Write an empty string when an option value is
None
. - If option is set in parent file, don't write it to trac.ini.
I'm not sure about (3). Maybe we should stick with the # option = <inherited>
notation, but only for options defined in an inherited file (not options that are None
).
Latest changes can be found in log:rjollos.git:t11520.2. There may be issues still. Some tests need to be written.
comment:9 by , 11 years ago
Description: | modified (diff) |
---|---|
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Change from comment:1 committed to 0.12-stable in [12663], merged in [12664:12665]. Related change in [12666:12667].
Other changes will be committed in #11437.
comment:10 by , 11 years ago
Owner: | set to |
---|
comment:11 by , 11 years ago
Milestone: | 1.0.2 → 0.12.6 |
---|
Hmm….
trac.web.main
is not declared in[trac.plugins]
ofsetup.py
.setup.py
After the patch: