|
From: Matthew B. <mat...@gm...> - 2005-12-05 12:30:34
|
Hi,
> First off you could create an external config file (or dictionary) with
> all your default values.
>
> Create the initial config file from the defaults. Then *update* with the
> user one.
I _think_ there's a problem with just an update though. Let's say I
have this in the defaults:
# File is default.ini
[section1]
option1 =3D True
[[subsection]]
more_options =3D False
# end of file
and I have this in my user config file:
# File is user.ini
[section1]
option1 =3D False
# end of file
If I do:
a =3D ConfigObj('defaults.ini')
b =3D ConfigObj('user.ini')
c =3D a.update(b)
- doesn't this end up wiping out my subsection, because update is not recur=
sive?
> *However* - validation includes a system for setting default values. You
> do this by including the default in the configspec.
I think I can't use the configspec defaults, because this will mean
that the defaults are filled in for every file I load, so I won't be
able to tell in my merge whether the values came from the file, or
from the defaults - but very happy to be corrected if that's not the
case...
Thanks again,
Matthew
|