|
From: <gar...@th...> - 2011-09-06 21:53:07
|
Hello there, thanks for this library tool!
Im trying to incorporate configobj-4.7.2 into an object to read
configuration files with default values. The configobj can load the
configurationfile fine, but the configspec default values are not being
read in, and therefore validation fails.
not sure if my code is at fault.
What steps will reproduce the problem?
1.
Im loading code like this:
config = ConfigObj( infile=self.config_file,
configspec=self.config_spec,
encoding='latin-1',
create_empty=True,
unrepr=True,
stringify=True,
)
2.
my config_file looks like this:
[Environment]
name = 'qapod5'
services =
email =
deploy_sso =
3.
my configspec looks like this:
[Environment]
name = string()
services = list(default=list(''))
email = string(default="tes...@th...")
deploy_sso = boolean(default=False)
4. my validator code looks like this:
val = Validator()
test = self.config.validate(val, preserve_errors=True, copy=True)
with the configspec above, i would expect that the loaded configobj
would have the defaults after being validated with the Validator.
However, i get this error:
ValidateError: [([u'Environment'], 'deploy_sso', VdtTypeError(u'the
value "" is of the wrong type.',)), ([u'Environment'], 'services',
VdtTypeError(u'the value "" is of the wrong type.',))]
Is my configspec not written properly?
Thanks,
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . .
Gary Siaw
Application Engineer, Paisley
Thomson Reuters
Phone: 763-450-4776
Fax: 763-450-4710
gar...@th... <mailto:gar...@th...>
paisley.thomsonreuters.com
|