Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #21901 > unrolled thread
| Started by | Andrea Crotti <andrea.crotti.0@gmail.com> |
|---|---|
| First post | 2012-03-19 14:44 +0000 |
| Last post | 2012-03-21 13:06 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: configobj validation Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-03-19 14:44 +0000
Re: configobj validation deets@web.de (Diez B. Roggisch) - 2012-03-21 12:40 +0100
Re: configobj validation Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-03-21 13:06 +0000
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
|---|---|
| Date | 2012-03-19 14:44 +0000 |
| Subject | Re: configobj validation |
| Message-ID | <mailman.812.1332168266.3037.python-list@python.org> |
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?
[toc] | [next] | [standalone]
| From | deets@web.de (Diez B. Roggisch) |
|---|---|
| Date | 2012-03-21 12:40 +0100 |
| Message-ID | <m2fwd289mf.fsf@web.de> |
| In reply to | #21901 |
Andrea Crotti <andrea.crotti.0@gmail.com> 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
[toc] | [prev] | [next] | [standalone]
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
|---|---|
| Date | 2012-03-21 13:06 +0000 |
| Message-ID | <mailman.859.1332335169.3037.python-list@python.org> |
| In reply to | #21980 |
On 03/21/2012 11:40 AM, Diez B. Roggisch wrote: > Andrea Crotti<andrea.crotti.0@gmail.com> writes: > > 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 I don't agree, if you write code that is supposed to work with Python3, using a library which is not developed and will probably never support Python3 is quite a stupid idea ;) Any other validation mechanism that can be plugged in ConfigParser for example? From what I've understood from the doc and what I remembered I thought that validation is automatically done when passing the configspec, but I'll check if the two steps work..
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web