Re: [Rest2web-develop] rest2web and ConfigObj
Brought to you by:
mjfoord
|
From: Nicola L. <ni...@te...> - 2005-08-10 17:40:40
|
>> The only thing really missing now is having "lists of sections", for the
>> cases when their number cannot be determined in advance. Maybe some easy
>> workaround can be found.
> I don't understand what you want. If you give me an example I'll think
> about it. It sounds like you need a way of referencing (naming)
> individual sections. Is this just for the programmer - or for the system
> administrator (the user).
My cousin has several cats and several dogs, and wants to "configure" them.
(I know, peculiar cousin.) I don't exactly know how many they are, and
moreover, their number could change with time.
All the cats have the same params among them, the same with dogs, but cats'
params are slightly different from dogs' params.
I write this configspec:
[ cats ]
[[ cat ]]
color = string
whiskers = int
[ dogs ]
[[ dog ]]
color = string
trained = boolean
Then I write this config file:
[ cats ]
[[ felix ]]
color = black
whiskers = 5
[[ miao ]]
color = white
whiskers = 7
[ dogs ]
[[ fido ]]
color = brown
trained = yes
[[ lassie ]]
color = grey
trained = no
[[ rintintin ]]
color = pink
trained = no
How do I specify that the "cat" configspec has to be used for the "felix"
and "miao" sections, while the "dog" configspec has to be used for the
"fido", "lassie" and "rintintin" sections?
Or better, how do I specify that, when reading the config file, all
subsections of the "cats" section have to be validated against the "cat"
configspec, and that all subsections of the "dogs" section have to be
validated against the "dog" configspec?
--
Nicola Larosa - ni...@te...
When I thought life had some purpose - Then I thought I had some choice
(I was running blind)
And I made some value judgments - In a self-important voice
(I was outa line)
But then absurdity came over me - And I longed to lose control
(into no mind)
Oh all I ever wanted - Was just to come in from the cold
-- Joni Mitchell, Come in from the cold, Night Ride Home, 1991
|