(trunk-1614) Sort entries in config file, so they don't jump around every time config is saved for easier troubleshooting
This commit is contained in:
parent
b7b8888745
commit
94b577484b
|
@ -2031,6 +2031,18 @@ class ConfigObj(Section):
|
||||||
out.append(line)
|
out.append(line)
|
||||||
|
|
||||||
indent_string = self.indent_type * section.depth
|
indent_string = self.indent_type * section.depth
|
||||||
|
|
||||||
|
# Do a little sorting for convenience
|
||||||
|
section.scalars = sorted(section.scalars)
|
||||||
|
section.sections = sorted(section.sections)
|
||||||
|
if 'default' in section.scalars:
|
||||||
|
# pop it and move to front
|
||||||
|
section.scalars.remove('default')
|
||||||
|
section.scalars.insert(0, 'default')
|
||||||
|
if 'default' in section.sections:
|
||||||
|
section.sections.remove('default')
|
||||||
|
section.sections.insert(0, 'default')
|
||||||
|
|
||||||
for entry in (section.scalars + section.sections):
|
for entry in (section.scalars + section.sections):
|
||||||
if entry in section.defaults:
|
if entry in section.defaults:
|
||||||
# don't write out default values
|
# don't write out default values
|
||||||
|
|
Loading…
Reference in New Issue