Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#3904 closed enhancement (fixed)

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

Reported by: ilias@… 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 Christian Boos, 18 years ago

Owner: changed from Jonas Borgström to Christian Boos

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)

comment:2 by ilias@…, 18 years ago

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

seems it's generated somewhere else.

comment:3 by ilias@…, 18 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 Christian Boos, 18 years ago

Milestone: 0.11
Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.