Edgewall Software

Ticket #3904 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

trac.ini "templates_dir" entry should not be creates (as it is redundant)

Reported by: ilias@… Owned by: cboos
Priority: normal Milestone: 0.11
Component: general Version: devel
Severity: normal Keywords:
Cc:

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

Change History

Changed 2 years ago by cboos

  • owner changed from jonas to cboos

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)

Changed 2 years ago by ilias@…

your patch works (technically), but templates_dir is still present within trac.ini.

seems it's generated somewhere else.

Changed 2 years ago by ilias@…

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>)

Changed 2 years ago by cboos

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 0.11

Well done, the usage of None was effectively required here. Fixed in [3914].

Add/Change #3904 (trac.ini "templates_dir" entry should not be creates (as it is redundant))

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from cboos. Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.