Message178710
Thanks, works for me.
I only noted the discrepancy and did not give it much thought.
I will just implement a merge method on top of read_dict.
That gives me all options that could be desired :).
However, after implementing the entire compatibility layer, I found one more issue:
Using self.remove_section() changes the section order during an update.
I would prefer that the section be cleared instead of removed in order to preserve the section order. Since OrderedDict does indeed preserve the key order during update, I think that this does not violate the Mapping Protocol.
If this is not desired, just go ahead and close the issue.
See also attached example bug_configparser_update_order.py:
OrderedDict does not change the order of keys upon .update():
>>> od = OrderedDict((('section1', {}), ('section2', {})))
>>> list(od.keys())
['section1', 'section2']
>>> od.update((('section1', {}), ('section3', {})))
>>> list(od.keys())
['section1', 'section2', 'section3']
But ConfigParser changes the order of sections upon .update():
>>> cfg = configparser.ConfigParser()
>>> cfg.update((('section1', {}), ('section2', {})))
>>> cfg.sections()
['section1', 'section2']
>>> cfg.update((('section1', {}), ('section3', {})))
>>> cfg.sections()
['section2', 'section1', 'section3'] |
|
Date |
User |
Action |
Args |
2012-12-31 17:42:49 | wolfmanx | set | recipients:
+ wolfmanx, lukasz.langa, python-dev |
2012-12-31 17:42:49 | wolfmanx | set | messageid: <1356975769.4.0.862090452.issue16820@psf.upfronthosting.co.za> |
2012-12-31 17:42:49 | wolfmanx | link | issue16820 messages |
2012-12-31 17:42:49 | wolfmanx | create | |
|