|
From: Michael F. <fuz...@vo...> - 2007-05-14 23:31:47
|
Thanks Arve - I'll look at this. Anyone else have an opinion on the
'raise an error or coerce to list' question ?
Michael
Arve Knudsen wrote:
>
>
> On 5/14/07, *Michael Foord* <fuz...@vo...
> <mailto:fuz...@vo...>> wrote:
>
> Arve Knudsen wrote:
> > Hi
> > I have a
> > problem with configobj/validate (in general a great
> combination!) that
> > keeps cropping up. If I forget to include a comma (',') when
> defining
> > a list value in my configuration file, it is translated into a
> string
> > (even though its specified type is 'list'). The fix is simply to
> add a
> > comma to the end of the configuration value. Is there any reason for
> > this behaviour? I find it rather painful since I have to check
> in my
> > own code whether supposed list values from configobj are actually
> > lists or strings.
> Can you post a minimal config and validation file that illustrates the
> problem, and I'll look at it.
>
>
> # Config
> values = val1
>
> # Reading config in Python
> import configobj, validate
>
> conf = configobj.ConfigObj("test.cfg", configspec={"values": "list"})
> vdt = validate.Validator ()
> conf.validate(vdt)
> # The configuration now contains a string value for parameter "values"
>
> In general, lists without commas aren't lists. :-)
>
>
> Yes, that much is obvious.
>
> I guess if an item is explicitly specified as a list then coercing a
> string into a single member list *sounds* like the right behaviour
> (rather than raising an error). Anyone else have any opinions?
>
>
> I would like this behaviour, otherwise the validation should raise an
> error instead of silently returning a string when a list was specified
> in the validation schema.
>
> Thanks,
> Arve
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Configobj-develop mailing list
> Con...@li...
> https://lists.sourceforge.net/lists/listinfo/configobj-develop
>
|