|
From: Daniel W. <D.M...@wa...> - 2007-12-14 01:33:00
Attachments:
signature.asc
|
Hi guys,
A couple of friends and I are writing an IRC bot, uChoob[0], and until
relatively recently were using ConfigParser. However, we found that it
didn't live up to our needs. As I'm a contributor to Bazaar, I took a
look at what they used, which brought us to ConfigObj.
First of all, I'd like to thank you for an excellent project. It's
made life much easier for us. Part of what has made it particularly
easy is the validation and type marshalling that you do for us, through
validate.py.
However, I'm running into problems when I want a string config option
to default to the empty string. If I use any of:
prefix =3D string(default=3D'')
prefix =3D string(default=3D"")
prefix =3D string(default=3DNone)
and don't specify a value in the config file, then prefix is set to '',
"" or 'None' respectively. If I use
prefix =3D string(default=3D)
then no default is set and I get a validation error.
Is there any way to get around this?
Cheers,
Dan
[Footnote 0: This should actually be mu-Choob, but ANSI didn't think to
include the Greek alphabet in the 128 characters available
to them. :p]
--=20
Daniel Watkins (Odd_Bloke)
University of Warwick Christian Focus President
University of Warwick Computing Society WUGLUG Liaison Officer
|
|
From: Michael F. <fuz...@vo...> - 2007-12-15 14:17:46
|
Daniel Watkins wrote: > Hi guys, > > A couple of friends and I are writing an IRC bot, uChoob[0], and until > relatively recently were using ConfigParser. However, we found that it > didn't live up to our needs. As I'm a contributor to Bazaar, I took a > look at what they used, which brought us to ConfigObj. > > First of all, I'd like to thank you for an excellent project. It's > made life much easier for us. Part of what has made it particularly > easy is the validation and type marshalling that you do for us, through > validate.py. > > However, I'm running into problems when I want a string config option > to default to the empty string. If I use any of: > prefix = string(default='') > prefix = string(default="") > prefix = string(default=None) > and don't specify a value in the config file, then prefix is set to '', > "" Does this *not* mean that prefix is set to an empty string? If it *does* mean that then what actually do you want to happen? Michael http://www.manning.com/foord > or 'None' respectively. If I use > prefix = string(default=) > then no default is set and I get a validation error. > > Is there any way to get around this? > > > Cheers, > > Dan > > > [Footnote 0: This should actually be mu-Choob, but ANSI didn't think to > include the Greek alphabet in the 128 characters available > to them. :p] > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services > for just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > ------------------------------------------------------------------------ > > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > |
|
From: Robin M. <rob...@gm...> - 2007-12-15 19:52:49
|
On Dec 15, 2007 8:17 AM, Michael Foord <fuz...@vo...> wrote: > Daniel Watkins wrote: > > However, I'm running into problems when I want a string config option > > to default to the empty string. If I use any of: > > prefix = string(default='') > > prefix = string(default="") > > prefix = string(default=None) > > and don't specify a value in the config file, then prefix is set to '', > > "" > > Does this *not* mean that prefix is set to an empty string? > > If it *does* mean that then what actually do you want to happen? I understood him to mean that the prefix gets set to one of: - a string consisting of two single quotes - a string consisting of two double quotes - a string containing the word "None" and what he actually wants is an empty string. -- Robin Munn Rob...@gm... GPG key 0x4543D577 |
|
From: Michael F. <fuz...@vo...> - 2007-12-15 22:59:31
|
Robin Munn wrote: > On Dec 15, 2007 8:17 AM, Michael Foord <fuz...@vo...> wrote: > >> Daniel Watkins wrote: >> >>> However, I'm running into problems when I want a string config option >>> to default to the empty string. If I use any of: >>> prefix = string(default='') >>> prefix = string(default="") >>> prefix = string(default=None) >>> and don't specify a value in the config file, then prefix is set to '', >>> "" >>> >> Does this *not* mean that prefix is set to an empty string? >> >> If it *does* mean that then what actually do you want to happen? >> > > I understood him to mean that the prefix gets set to one of: > > - a string consisting of two single quotes > - a string consisting of two double quotes > - a string containing the word "None" > > and what he actually wants is an empty string. > > If that is the case then I will have to test it and fix it. There is another problem with validate turning strings into lists that needs fixing. Unfortunately I am kind of tied up with writing a wretched book - so I will have to make time for it somewhere. On the other hand validate is pretty simple code so if anyone wants to send a patch (with tests)... :-) Michael http://www.manning.com/foord |