diff options
author | fuzzyman <devnull@localhost> | 2009-12-13 23:00:59 +0000 |
---|---|---|
committer | fuzzyman <devnull@localhost> | 2009-12-13 23:00:59 +0000 |
commit | 176324adf691052eb61dcc79d5aa510e0e901392 (patch) | |
tree | 47a6d3e86a924cc4229f729e9cb129b14920b4f8 /configobj.py | |
parent | 664df64c7d3dae37de86bc2af0a9a55180fbe5d7 (diff) | |
download | configobj-176324adf691052eb61dcc79d5aa510e0e901392.tar.gz |
Creating a ConfigObj from another ConfigObj instance preserves order.
Diffstat (limited to 'configobj.py')
-rw-r--r-- | configobj.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/configobj.py b/configobj.py index e9e6710..3be82d7 100644 --- a/configobj.py +++ b/configobj.py @@ -1264,10 +1264,17 @@ class ConfigObj(Section): # the Section class handles creating subsections if isinstance(infile, ConfigObj): # get a copy of our ConfigObj - infile = infile.dict() + def set_section(in_section, this_section): + for entry in in_section.scalars: + this_section[entry] = in_section[entry] + for section in in_section.sections: + this_section[section] = {} + set_section(in_section[section], this_section[section]) + set_section(infile, self) - for entry in infile: - self[entry] = infile[entry] + else: + for entry in infile: + self[entry] = infile[entry] del self._errors if configspec is not None: |