#3425: WebAdmin should be more conservative with trac.ini
-------------------------+--------------------------------------------------
 Reporter:  eblot        |        Owner:  cmlenz
     Type:  enhancement  |       Status:  new   
 Priority:  lowest       |    Milestone:        
Component:  webadmin     |      Version:  devel 
 Severity:  minor        |   Resolution:        
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by eblot):

 I was thinking about augmenting the !ConfigParser class, so that it
 preserves the original order of `trac.ini` file

 For example, the [http://www.voidspace.org.uk/python/odict.html ordered
 dictionary] (BSD license) could be used to store the ''sections'' and
 ''options'' rather than in the default Python dictionary used by the
 !ConfigParser.

 I'm attaching a simple proof-of-concept patch for the current trunk. I
 made a couple of tests with WebAdmin and the `trac.ini` looked ok. I also
 ran the non-regression test suite. Basically, the patch:
  * adds the `odict.py` module
  * overrides the `__init__`, `add_section` and `_read` methods of the
 !ConfigParser
  * replaces the !ConfigParser used in the `config.py` file with an
 !OrderedConfigParser
  * changes the way the `trac.ini` file is built (filter out options from
 the existing parser rather than building a new one)

 I did not find another way but overrides the `_read`method of the
 !ConfigParser for a single-line change ;-(

 The patch is a bit overkill for a "simple" add-on like this on.

-- 
Ticket URL: <http://trac.edgewall.org/ticket/3425>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to