|
From: Michael F. <fuz...@vo...> - 2010-03-19 15:57:21
|
On 17/03/2010 02:13, Chaim Krause wrote:
> *[snip...]*
> *I think it needs to be...*
>
> from configobj import ConfigObj, flatten_errors
> from validate import Validator
>
> config = ConfigObj('config.ini', configspec='configspec.ini')
> validator = Validator()
> results = config.validate(validator, preserve_errors=True)
>
Actually, the code that calls flatten_errors doesn't use the third entry
from each tuple (the error object) - so I don't think it is necessary to
use preserve_errors for that particular example.
> if results != True:
> for (section_list, key, _) in flatten_errors(config, results):
> if key is not None:
> print 'The "%s" key in the section "%s" failed validation' % (key, ',
> '.join(section_list))
> else:
> print 'The following section was missing: "%s"' % ', '.join(section_list)
>
These two are definitely mistakes though.
Thanks
Michael
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
>
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
|