|
From: Michael F. <fuz...@vo...> - 2008-05-09 12:08:16
|
Hello Jesse, Sorry for the late reply. Looking at it, it seems to be quite a serious problem and I can't see anything you have done wrong. I'll try and look at this in more detail tonight - I've cc'ed the configobj-develop mailing list. Michael http://www.ironpythoninaction.com Jesse Noller wrote: > He Michael - I hope you don't mind me dropping you a line about this - > > Using the latest configObj and validator code - I am trying to build > up a config file and spec and then do the validation/type coercion on > it offered by configObj - and I am running into a mystifying issue - > for example, here is the config file: > > ["network_options"] > portal_port = > > And here is the spec: > ["network_options"] > portal_port = integer(min=0, default=8082) > > When I try this: > > vdt = Validator() > configspec = ConfigObj('config.spec') > config = ConfigObj(configFile, configspec=configspec) > config.validate(vdt) > > It explodes with: > > Traceback (most recent call last): > File "ctransfer.py", line 92, in <module> > sys.exit(main(sys.argv[1])) > File "ctransfer.py", line 85, in main > config = load_conf > ig(configFile) > File "ctransfer.py", line 49, in load_config > config.validate(vdt) > File "/Library/Python/2.5/site-packages/configobj.py", line 2301, in validate > copy=copy, section=section[entry]) > File "/Library/Python/2.5/site-packages/configobj.py", line 2245, in validate > missing=missing > File "/Library/Python/2.5/site-packages/validate.py", line 595, in check > fun_name, fun_args, fun_kwargs, default = self._parse_with_caching(check) > File "/Library/Python/2.5/site-packages/validate.py", line 620, in > _parse_with_caching > if check in self._cache: > TypeError: list objects are unhashable > > I added some debugging (print statements for the win) to the code and > found that check looks like this: > > ['integer(min=0', 'default=8082)'] > > So on line 619 - check is actually being passed in as a list so the if > check in self._cache check fails. Did I do something horribly wrong > here? > > -jesse > |