Opened 19 years ago
Closed 19 years ago
#3904 closed enhancement (fixed)
trac.ini "templates_dir" entry should not be creates (as it is redundant)
| Reported by: | Owned by: | Christian Boos | |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11 |
| Component: | general | Version: | devel |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
The trac.ini entry for "templates_dir"
templates_dir = Option('trac', 'templates_dir', default_dir('templates'), ...
seems to be redundant (at least at environment creation time), because the templates_dir = default_dir('templates') is already configured during the basic trac installation (siteconfig.py).
The suggestion is to use it if existent (backwards compatibility), but to _not_ create the "templates_dir" entry in new enviroments created by initenv.
Attachments (0)
Change History (4)
comment:1 by , 19 years ago
| Owner: | changed from to |
|---|
comment:2 by , 19 years ago
your patch works (technically), but templates_dir is still present within trac.ini.
seems it's generated somewhere else.
comment:3 by , 19 years ago
this one does the work (i've verified it in the 0.10 installation, as I've a little problems with getting 0.11 running):
!#python
if templates_dir != default_dir('templates'):
options.append(('trac', 'templates_dir', templates_dir))
else:
options.append(('trac', 'templates_dir', None))
results in:
# templates_dir = <set in global trac.ini>
but that's ok for now (text will change in future, e.g. <inherited>)
comment:4 by , 19 years ago
| Milestone: | → 0.11 |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
Well done, the usage of None was effectively required here. Fixed in [3914].



Seems reasonable to me.
Can you try the following patch?
Index: trac/scripts/admin.py =================================================================== --- trac/scripts/admin.py (revision 3880) +++ trac/scripts/admin.py (working copy) @@ -570,9 +570,10 @@ ('trac', 'database', db_str), ('trac', 'repository_type', repository_type), ('trac', 'repository_dir', repository_dir), - ('trac', 'templates_dir', templates_dir), ('project', 'name', project_name), ] + if templates_dir != default_dir('templates'): + options.append(('trac', 'templates_dir', templates_dir)) try: self.__env = Environment(self.envname, create=True, options=options)