Edgewall Software

Opened 10 years ago

Last modified 3 years ago

#11538 closed defect

Duplicate options are allowed in sections of trac.ini — at Initial Version

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone: 1.5.3
Component: general Version:
Severity: normal Keywords: config python3
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The sections of trac.ini allow duplicate options, with later values overwriting those that come first. Two patterns are possible, which could lead to confusing behavior when the user doesn't realize there the value is being redefined later in the file:

  1. Duplicate sections with the same option.
    [trac]
    default_handler = WikiModule
    
    ...
    
    [trac]
    default_handler = TicketModule
    
  2. Duplicate options within a section.
    [trac]
    default_handler = WikiModule
    
    ...
    
    default_handler = TicketModule
    

While Python 3.x has a much improved configparser module with a strict mode that raises an error when an option is redefined, I'm not sure there is much we can do in Python 2.x using ConfigParser.

SO:5396653 suggests using a dict_type that allows multiple values with the same key, however dict_type is only supported in Python 2.6.

Change History (0)

Note: See TracTickets for help on using tickets.