Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!not-for-mail From: deets@web.de (Diez B. Roggisch) Newsgroups: comp.lang.python Subject: Re: configobj validation Date: Wed, 21 Mar 2012 12:40:56 +0100 Lines: 33 Message-ID: References: <4F672DBF.5060506@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de riScKMwPjm6BYRYlidMvow43dipNqZujT+joncN/tuWCB4Y+usAa8W Cancel-Lock: sha1:1uSLDweoptIK0uiTcCX0EW3W2Mc= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Xref: csiph.com comp.lang.python:21980 Andrea Crotti writes: > On 03/19/2012 12:59 PM, Andrea Crotti wrote: >> I seemed to remember that type validation and type conversion worked >> out of the box, but now >> I can't get it working anymore. >> >> Shouldn't this simple example actually fail the parsing (instead it >> parses perfectly port to a string)? >> >> sample.py: >> from configobj import ConfigObj >> >> conf = ConfigObj('sample.conf', configspec='sample.spec') >> >> sample.conf: >> port = some_string >> >> sample.spec: >> port = integer(0, 10) >> >> PS. using configobj 4.7.2 > > I now checked the repo and configobj seems also quite dead (2 years > ago last version), it's a pity because it's a really nice library. > Any other alternatives for validation/configuration systems otherwise? It works - so why do you bother? And I'm not sure about the above code - AFAIK, validation is a two-step thing: http://www.voidspace.org.uk/python/articles/configobj.shtml#validation Diez