Opened 18 years ago
Closed 18 years ago
#5303 closed defect (fixed)
Unify default trac.ini and trac.ini.sample contents
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10.5 |
Component: | admin/console | Version: | 0.10.4 |
Severity: | normal | Keywords: | config trac.ini.sample |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
After fresh inienv there are two files trac.ini and trac.ini.sample However it is not possible to say if they are the same or not, because the order of entries is not the same - so diff fails to make readable output from it.
The request is to make trac.ini and trac.ini.sample the same to clarly see the change after Trac upgrade by comparing these two with diff utility.
Attachments (2)
Change History (6)
by , 18 years ago
by , 18 years ago
Attachment: | trac.ini.sample added |
---|
comment:1 by , 18 years ago
Milestone: | → 0.11 |
---|
comment:2 by , 18 years ago
Here is a patch for 0.10.4 that is still actual for trunk.
--- site-packages/trac/env_old.py Wed Apr 11 16:09:24 2007 +++ site-packages/trac/env.py Sun May 13 20:18:16 2007 @@ -422,20 +422,13 @@ # Internal methods def _update_sample_config(self): - from ConfigParser import ConfigParser - config = ConfigParser() - for section, options in self.config.defaults().items(): - config.add_section(section) - for name, value in options.items(): - config.set(section, name, value) filename = os.path.join(self.env.path, 'conf', 'trac.ini.sample') + config = Configuration(filename) + for section, default_options in config.defaults().iteritems(): + for name, value in default_options.iteritems(): + config.set(section, name, value) try: - fileobj = file(filename, 'w') - try: - config.write(fileobj) - fileobj.close() - finally: - fileobj.close() + config.save() self.log.info('Wrote sample configuration file with the new ' 'settings and their default values: %s', filename)
comment:3 by , 18 years ago
Keywords: | config trac.ini.sample added |
---|---|
Milestone: | 0.11 → 0.10.5 |
Owner: | changed from | to
Ah, yes, I forgot that the writing of the trac.ini.sample
was still done using ConfigParser.write
. Using the same method for writing both is then the correct fix. Thanks for the patch which works fine.
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
We originally avoided to re-write the trac.ini on purpose, as this would make you loose any comments. But the WebAdmin module is re-writing the trac.ini file anyway, so it's probably not such a big deal.
Also, what changed since the original implementation of the trac.ini.sample is that we now write the trac.ini file ourselves (i.e. not using
ConfigParser.write()
), so I wonder if there couldn't be an even simpler way to show the defaults.Would be nice to have for 0.11…