What INI config file module allows lists of duplicate same-named options?
Thomas L. Shinnick
tshinnic at io.com
Sun Jan 9 16:11:15 EST 2011
At 02:52 PM 1/9/2011, Stefan Sonnenberg-Carstens wrote:
>Am 09.01.2011 21:43, schrieb Thomas L. Shinnick:
>>Having (possibly) surveyed all the available pypi config file
>>modules, I still haven't seen one that allows an obvious and
>>familiar extension of the strict Windows INI format.
>>
>>Each INI-style config module seems to enforce the strict rule: each
>>option in a section must have a different name - no
>>duplicates. Thus it is impossible to have a simple list, e.g.
>>
>> [pathset uk]
>> pathpair: /bath/* to /london/*
>> pathpair: /bath/upload/** to /london/*
>> pathpair: /firth/* to /forth/*
>> pathpair: /firth/upload/** to /forth/*
>>
>>Rather you must give each line a separate name, e.g.
>>
>> [pathset uk]
>> pathpair001: /bath/* to /london/*
>> pathpair002: /bath/upload/** to /london/*
>> pathpair003: /firth/* to /forth/*
>> pathpair004: /firth/upload/** to /forth/*
>> | | | | | |
>> pathpair068: /glasgow/* to /edinburgh/*
>> pathpair069: /glasgow/upload/** to /edinburgh/*
>> | | | | | |
>>
>>This is not ideal for a number of reasons. Do you know of a
>>library module that has the (optional?) ability to handle
>>duplicate-named options, returning them as a list?
>>
>>If instead someone can point me to a reasonable Apache-style config
>>module, that might also serve. I've looked for such and the few
>>found seemed to be either bare bones or clumsily stripped out of
>>something much larger.
>>
>>
>>--
>>I'm a pessimist about probabilities; I'm an optimist about possibilities.
>> Lewis Mumford (1895-1990)
>I've let ini style files alone some time ago.
>Whenever possible I use JSON based files.
>
>Your example could then look like this:
>
>{
>"pathpairs":{
> "uk":[
> ["/bath/*","/london/*"],
> ["/bath/upload/**","/london/*"],
> ["/firth/*,"/forth/*"],
> ["/firth/upload/**","/forth/*"]
> ]
>}
>}
>
>Since Python 2.7, json is in the standard library.
A reasonable response, if your only audience is computer folk. And
used internally already. But in trying to be simple as can be for
those installing and maintaining a package, INI-style configurations
are a familiar format. As Apache-style configs would be. So, JSON
is concise and flexible and easily handled by programs. But I was
hoping for something easier for the poor soul coming back to a config
after 2 months and wondering how to add something ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110109/8e3ca8bc/attachment-0001.html>
More information about the Python-list
mailing list