trac.ini upgrade to Trac 1.4.1 results in new [mainnav] ordering

55 views
Skip to first unread message

Aikido Guy

unread,
May 29, 2020, 10:00:37 PM5/29/20
to Trac Users
Hi,

I have a global trac.ini file that contains [mainnav] information. This global ini file is read-only.

I also have a project specfic trac.ini file that is read-and-writable for an older version of Trac that inherits the global ini file.

When I perform a trac-admin upgrade of the project specific file, the process adds a new [mainnav] section (and a new [metanav] section) to the project specific trac.ini file
- the new [mainnav] section contains different *.order values than my global [mainnav] file
- this results in an unexpected tab ordering when I load it in my browser

Work around:
- If I comment out this new [mainnav] section in my project trac.ini file then my project is displayed with the tabs in the expected order as per my global trac.ini file
- No other changes are needed to get it to work properly

Question:
Is there a way to upgrade all of my 60 projects and keep my [mainnav] items in the correct order as per my global trac.ini file?

Kindly,
Aikido Guy

RjOllos

unread,
May 29, 2020, 10:45:08 PM5/29/20
to Trac Users
In Trac < 1.2, the order is configured through the [trac] mainnav and [trac] metanav entries:

The db41 upgrade steps writes these to [mainnav] and [metanav] sections:

If you are upgrading from Trac < 1.2 your mainnav and metanav ordering should be configured in the [trac] mainnav and [trac] metanav options.

It likely fails to account for the possibility that [trac] mainnav and [trac] metanav are configured in an inherited config file. In that case, it should issue a warning message and not modify the env trac.ini file.

However, since that won't get fixed until at least trac.1.4.2, you'll need a different solution.

Unfortunately it's also try that "trac-admin $env config remove mainnav" does not remove the mainnav section.

Instead, you'll have to remove each option:

for opt in wiki ticket newticket timeline roadmap browser search admin
do
    trac-admin $env config remove mainnav $opt.order
done

When the last section option is removed, the section header [mainnav] will also be removed.

RjOllos

unread,
May 29, 2020, 11:47:09 PM5/29/20
to Trac Users


On Friday, May 29, 2020 at 7:45:08 PM UTC-7, RjOllos wrote:

A few clarifications.

On Friday, May 29, 2020 at 7:00:37 PM UTC-7, Aikido Guy wrote:
Hi,

I have a global trac.ini file that contains [mainnav] information. This global ini file is read-only.

I also have a project specfic trac.ini file that is read-and-writable for an older version of Trac that inherits the global ini file.

When I perform a trac-admin upgrade of the project specific file, the process adds a new [mainnav] section (and a new [metanav] section) to the project specific trac.ini file
- the new [mainnav] section contains different *.order values than my global [mainnav] file
- this results in an unexpected tab ordering when I load it in my browser

Work around:
- If I comment out this new [mainnav] section in my project trac.ini file then my project is displayed with the tabs in the expected order as per my global trac.ini file
- No other changes are needed to get it to work properly

Question:
Is there a way to upgrade all of my 60 projects and keep my [mainnav] items in the correct order as per my global trac.ini file?

Kindly,
Aikido Guy

In Trac < 1.2, the order is configured through the [trac] mainnav and [trac] metanav entries:

The db41 upgrade steps writes these to [mainnav] and [metanav] sections:

If you are upgrading from Trac < 1.2 your mainnav and metanav ordering should be configured in the [trac] mainnav and [trac] metanav options

Meaning, the inherited config file you used with Trac < 1.0 should have defined the ordering using the [trac] mainnav and [trac] metanav options
 
It likely fails to account for the possibility that [trac] mainnav and [trac] metanav are configured in an inherited config file. In that case, it should issue a warning message and not modify the env trac.ini file.
 
To the point, there is a defect in the upgrade step that will be dealt with in #11306

However, since that won't get fixed until at least trac.1.4.2, you'll need a different solution.

Unfortunately it's also tr[ue] that "trac-admin $env config remove mainnav" does not remove the mainnav section.

Aikido Guy

unread,
May 31, 2020, 5:37:43 PM5/31/20
to Trac Users
On Friday, May 29, 2020 at 11:47:09 PM UTC-4, RjOllos wrote:
On Friday, May 29, 2020 at 7:45:08 PM UTC-7, RjOllos wrote:
On Friday, May 29, 2020 at 7:00:37 PM UTC-7, Aikido Guy wrote:
I have a global trac.ini file that contains [mainnav] information. This global ini file is read-only.
 
I should have also mentioned that:
(1) I created a test environment from scratch and got it to work
(2) I manually modified all entries in my global ini file

I also have a project specfic trac.ini file that is read-and-writable for an older version of Trac that inherits the global ini file.

(3) All of my project specific ini files are read-writable and I let the upgrade process rewrite them as needed

When I perform a trac-admin upgrade of the project specific file, the process adds a new [mainnav] section (and a new [metanav] section) to the project specific trac.ini file
- the new [mainnav] section contains different *.order values than my global [mainnav] file
- this results in an unexpected tab ordering when I load it in my browser

Work around:
- If I comment out this new [mainnav] section in my project trac.ini file then my project is displayed with the tabs in the expected order as per my global trac.ini file
- No other changes are needed to get it to work properly

Question:
Is there a way to upgrade all of my 60 projects and keep my [mainnav] items in the correct order as per my global trac.ini file?

In Trac < 1.2, the order is configured through the [trac] mainnav and [trac] metanav entries:

The db41 upgrade steps writes these to [mainnav] and [metanav] sections:

If you are upgrading from Trac < 1.2 your mainnav and metanav ordering should be configured in the [trac] mainnav and [trac] metanav options

Meaning, the inherited config file you used with Trac < 1.0 should have defined the ordering using the [trac] mainnav and [trac] metanav options
 
It likely fails to account for the possibility that [trac] mainnav and [trac] metanav are configured in an inherited config file. In that case, it should issue a warning message and not modify the env trac.ini file.
 
To the point, there is a defect in the upgrade step that will be dealt with in #11306

However, since that won't get fixed until at least trac.1.4.2, you'll need a different solution.

Unfortunately it's also tr[ue] that "trac-admin $env config remove mainnav" does not remove the mainnav section.

Instead, you'll have to remove each option:

for opt in wiki ticket newticket timeline roadmap browser search admin
do
    trac-admin $env config remove mainnav $opt.order
done

When the last section option is removed, the section header [mainnav] will also be removed.


Thank you for the for loop above and the comment below it. I added such a thing after the upgrade in order to "corrrect" my project specific ini files.
- I just tested this process on one of my projects and it works as advertised...

Thank you kindly!
Aikido Guy
Reply all
Reply to author
Forward
0 new messages