Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#2324 closed defect (fixed)

global trac.ini settings don't work consistently

Reported by: thomas.jachmann@… Owned by: Christopher Lenz
Priority: high Milestone: 0.9.4
Component: general Version: 0.9
Severity: normal Keywords:
Cc: kazarmy@…, dserodio@…, adeason@…, thomas.jachmann@… Branch:
Release Notes:
API Changes:

Description

After upgrading to trac 0.9, I moved all my non project specific configuration to /usr/share/trac/conf/trac.ini, only leaving a minimal set of settings in the environment's configuration files, in the most simple case just trac→repository_dir and project→name. Unfortunately, not all settings got set for all the environments.

Examples:

  • I defined a custom field in ticket-custom. The field itself was there, but the name wasn't displayed.
  • Using the ldap extension http://trac-hacks.swapoff.org/wiki/LdapPlugin doesn't work - the extension gets loaded but is disabled since the "enable" setting isn't set properly

These are just small examples, but all in all, the central trac.ini doesn't seem to work - do extensions need to access the settings in a different way?

Attachments (1)

2324.diff (583 bytes ) - added by Christopher Lenz 14 years ago.
Proposed patch

Download all attachments as: .zip

Change History (18)

comment:1 by anonymous, 14 years ago

Cc: kazarmy@… added

comment:2 by dserodio@…, 14 years ago

Cc: dserodio@… added

comment:3 by Christopher Lenz, 14 years ago

Milestone: 0.9.3
Owner: changed from Jonas Borgström to Christopher Lenz
Status: newassigned

comment:4 by Christopher Lenz, 14 years ago

The attached patch should fix the issue. Please test if you have a chance.

by Christopher Lenz, 14 years ago

Attachment: 2324.diff added

Proposed patch

comment:5 by adeason@…, 14 years ago

Cc: adeason@… added

Sorry if I'm missing something obvious, but why doesn't config.py just call self.parser.read([self.site_filename, self.filename]) in parse_if_needed()? It seems like that would load all defaults, and override them automatically with environment-specific values. Is there a reason normal values are kept separate from default values, like it is now?

comment:6 by Christopher Lenz, 14 years ago

In that case I don't think we could differentiate between global and local config values… which would mean that all of the values would get written back to the local config file on save(). Obviously not what we want here.

comment:7 by adeason@…, 14 years ago

Okay, thanks, that's what I was missing. The reason I asked is that about/config doesn't reflect global values in most sections, unless a local value has been set in that section. This is because I presume about/config calls sections(), which would only return the sections in the local config. Should sections() also include sections only in the global config? The patch appears to work, by the way, after minimal testing.

comment:8 by thomas.jachmann <thomas.jachmann@…>, 14 years ago

Cc: thomas.jachmann@… added

Concerning writing all settings to the local config file on save(): Isn't this what happens anyway? I remember having all settings written to the local file after using WebAdmin and changing the default component. Before, only minimal settings were in the local file. Only changed settings should be written to the local file in this case.

comment:9 by adeason@…, 14 years ago

Basically…. no. At least, that's not what happens with any of my installations. Webadmin just calls save(), which calls the write() method on the local config parser.

comment:10 by Thomas Jachmann <thomas.jachmann@…>, 14 years ago

I don't know the code or have enough insight to judge what happens inside, but it seems to write all available settings (whether read from local or global trac.ini) to the local file. At least that is what happens on my 0.9.2 installation. This makes the feature of a global trac.ini rather useless. You'll have a local copy of the global trac.ini as soon as you change something like the default component using WebAdmin. Further changes of the global file will be ignored since they're overwritten with the old values locally.

comment:11 by adeason@…, 14 years ago

I do agree that in that case, it would be quite useless. However, that is not what happens with my 0.9.2 installation. Can anyone else comment on what happens? And just for reference, I believe the relevant code is around line 81 of config.py:

    def save(self):
        if not self.filename:
            return
        fileobj = file(self.filename, 'w')
        try:
            self.parser.write(fileobj)
        finally:
            fileobj.close()

And around line 80 of ticket.py in the webadmin module:

                # Set default component
                elif req.args.get('apply'):
                    if req.args.get('default'):
                        name = req.args.get('default')
                        self.log.info('Setting default component to %s',
name)
                        self.config.set('ticket', 'default_component',
name)
                        self.config.save()
                        req.redirect(self.env.href.admin(cat, page))

comment:12 by anonymous, 14 years ago

Milestone: 0.9.30.9.4

comment:13 by anonymous, 14 years ago

Resolution: fixed
Status: assignedclosed

comment:14 by Christian Boos, 14 years ago

Resolution: fixed
Status: closedreopened

Please never close a ticket without an explanation (especially if you're anonymous)

comment:15 by Christopher Lenz, 14 years ago

Resolution: fixed
Status: reopenedclosed

Should be fixed in [2883] and [2884].

comment:16 by Thomas Jachmann <thomas.jachmann@…>, 14 years ago

Does this also fix the behaviour that all settings will be written to the local trac.ini no matter whether they originated from it or from the global trac.ini upon save()? Or am I the only one getting this behaviour? As far as I've seen, the two changesets only affect read methods.

comment:17 by Christopher Lenz, 14 years ago

No it doesn't, and no, I'm not seeing that behavior. Please file a new ticket with details so we can try to reproduce.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Christopher Lenz 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.