|
From: Arve K. <arv...@gm...> - 2007-05-14 18:18:08
|
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.
Arve
|
|
From: Michael F. <fuz...@vo...> - 2007-05-14 18:23:02
|
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.
In general, lists without commas aren't lists. :-)
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?
Michael
http://www.voidspace.org.uk/python/index.shtml
>
> 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
>
|
|
From: Arve K. <arv...@gm...> - 2007-05-14 19:44:56
|
On 5/14/07, Michael Foord <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
|
|
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
>
|
|
From: Nicola L. <ni...@te...> - 2007-05-15 04:39:16
|
Michael Foord wrote: >> 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 - I'll look at this. Anyone else have an opinion on the > 'raise an error or coerce to list' question ? I don't need to remind you the timeless lesson of the ages before us: ;-) "Explicit is better than implicit. ... Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess." There is an ambiguity in *meaning* here, so definitely raise an error. -- Nicola Larosa - http://www.tekNico.net/ That's what *professionals* do. They are always learning. Always. Because nothing you learn about what's "the best" or "the worst" stays the same forever. And if you don't keep up, you're just falling behind. -- Phillip J. Eby, January 2007 |
|
From: Arve K. <arv...@gm...> - 2007-05-15 07:41:24
|
On 5/15/07, Nicola Larosa <ni...@te...> wrote: > > Michael Foord wrote: > >> 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 - I'll look at this. Anyone else have an opinion on the > > 'raise an error or coerce to list' question ? > > I don't need to remind you the timeless lesson of the ages before us: ;-) > > "Explicit is better than implicit. > ... > Errors should never pass silently. > Unless explicitly silenced. > In the face of ambiguity, refuse the temptation to guess." > > There is an ambiguity in *meaning* here, so definitely raise an error. I don't see any big _practical_ benefit of this level of strictness, especially since this affects users (non-programmers) directly. I find it more user friendly to accept strings for single-value lists, since the only difference is a comma at the end anyhow. I'd say this behaviour amounts to the least surprise, although others may disagree. Arve |
|
From: Arve K. <arv...@gm...> - 2007-08-22 19:09:15
|
Just checking if anything is being done about this issue? Arve On 5/16/07, Michael Foord <ar...@vo...> wrote: > > Nicola Larosa wrote: > > Michael Foord wrote: > > > >>> 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 - I'll look at this. Anyone else have an opinion on the > >> 'raise an error or coerce to list' question ? > >> > > > > I don't need to remind you the timeless lesson of the ages before us: > ;-) > > > > "Explicit is better than implicit. > > ... > > Errors should never pass silently. > > Unless explicitly silenced. > > In the face of ambiguity, refuse the temptation to guess." > > > > There is an ambiguity in *meaning* here, so definitely raise an error. > > > I'm still slightly reluctant, if the entry is meant to be a list then a > single entry is valid and we're debating syntax. > > On the other hand there *is* a potential cause for confusion - so at > least an error will signal where the problem is. I think this is > probably the right thing to do. > > There is possibly also an issue with empty values and empty lists as well. > > I'll look into it. > > Michael > > > > ------------------------------------------------------------------------- > 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 > |
|
From: Michael F. <ar...@vo...> - 2007-05-15 23:21:17
|
Nicola Larosa wrote: > Michael Foord wrote: > >>> 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 - I'll look at this. Anyone else have an opinion on the >> 'raise an error or coerce to list' question ? >> > > I don't need to remind you the timeless lesson of the ages before us: ;-) > > "Explicit is better than implicit. > ... > Errors should never pass silently. > Unless explicitly silenced. > In the face of ambiguity, refuse the temptation to guess." > > There is an ambiguity in *meaning* here, so definitely raise an error. > I'm still slightly reluctant, if the entry is meant to be a list then a single entry is valid and we're debating syntax. On the other hand there *is* a potential cause for confusion - so at least an error will signal where the problem is. I think this is probably the right thing to do. There is possibly also an issue with empty values and empty lists as well. I'll look into it. Michael |
|
From: Michael F. <fuz...@vo...> - 2007-08-22 20:58:57
|
Arve Knudsen wrote: > Just checking if anything is being done about this issue? I'm afraid I haven't had a chance to look at this yet. :-( It is still 'on my list' though, and everything does get done eventually... Michael > > Arve > > On 5/16/07, *Michael Foord* <ar...@vo... > <mailto:ar...@vo...>> wrote: > > Nicola Larosa wrote: > > Michael Foord wrote: > > > >>> 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 - I'll look at this. Anyone else have an opinion on > the > >> 'raise an error or coerce to list' question ? > >> > > > > I don't need to remind you the timeless lesson of the ages > before us: ;-) > > > > "Explicit is better than implicit. > > ... > > Errors should never pass silently. > > Unless explicitly silenced. > > In the face of ambiguity, refuse the temptation to guess." > > > > There is an ambiguity in *meaning* here, so definitely raise an > error. > > > I'm still slightly reluctant, if the entry is meant to be a list > then a > single entry is valid and we're debating syntax. > > On the other hand there *is* a potential cause for confusion - so at > least an error will signal where the problem is. I think this is > probably the right thing to do. > > There is possibly also an issue with empty values and empty lists > as well. > > I'll look into it. > > Michael > > > > ------------------------------------------------------------------------- > 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... > <mailto:Con...@li...> > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > ------------------------------------------------------------------------ > > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > |
|
From: Arve K. <arv...@gm...> - 2007-08-22 21:34:04
|
On 8/22/07, Michael Foord <fuz...@vo...> wrote: > > Arve Knudsen wrote: > > Just checking if anything is being done about this issue? > > I'm afraid I haven't had a chance to look at this yet. :-( > > It is still 'on my list' though, and everything does get done > eventually... OK. Arve > > > Arve > > > > On 5/16/07, *Michael Foord* <ar...@vo... > > <mailto:ar...@vo...>> wrote: > > > > Nicola Larosa wrote: > > > Michael Foord wrote: > > > > > >>> 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 - I'll look at this. Anyone else have an opinion on > > the > > >> 'raise an error or coerce to list' question ? > > >> > > > > > > I don't need to remind you the timeless lesson of the ages > > before us: ;-) > > > > > > "Explicit is better than implicit. > > > ... > > > Errors should never pass silently. > > > Unless explicitly silenced. > > > In the face of ambiguity, refuse the temptation to guess." > > > > > > There is an ambiguity in *meaning* here, so definitely raise an > > error. > > > > > I'm still slightly reluctant, if the entry is meant to be a list > > then a > > single entry is valid and we're debating syntax. > > > > On the other hand there *is* a potential cause for confusion - so at > > least an error will signal where the problem is. I think this is > > probably the right thing to do. > > > > There is possibly also an issue with empty values and empty lists > > as well. > > > > I'll look into it. > > > > Michael > > > > > > > > > ------------------------------------------------------------------------- > > 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... > > <mailto:Con...@li...> > > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > > > > > ------------------------------------------------------------------------ > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. > > Still grepping through log files to find problems? Stop. > > Now Search log events and configuration files using AJAX and a browser. > > Download your FREE copy of Splunk now >> http://get.splunk.com/ > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Configobj-develop mailing list > > Con...@li... > > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > |