|
From: Michael F. <fuz...@vo...> - 2011-01-03 13:37:56
|
On 26/12/2010 11:49, Stefan Parviainen wrote: > I've noticed some issues with how list types are handled in Validate. > There are several different list types, including, int_list for > integers, string_list for strings, etc. IMHO the list handling could > be generalized to be much more useful. > > Right now there is no easy way to declare a list of e.g. integers with > min and max values. You could declare a completely new type, > "list_of_ints_min_0_max_10" but in practice it's not really feasible. > It's also not easily possible to declare a list containing some custom > type. > > I think an optional argument, type, should be added to the list type, > so something like this would be possible: > > list(type=int(min=0,max=10), min=1, max=2) > > This would also solve problems with inconsistent naming (integer vs. > int_list types). The old types could be kept for backwards > compatibility. This sounds like a good change. > I've reported one issue related to lists, and three other issues (some > with patches) to the Google Code issue tracker at > http://code.google.com/p/configobj/issues/ but have not gotten any > reaction to them. Is the Google Code tracker the correct place to > report bugs? If not, could this be clarified somewhere? > Google code tracker is the correct place. I'm not using ConfigObj a great deal myself at the moment so don't have much spare time to work on it. I will eventually get to it though. I see you submitted a patch along with issue 26, but no tests. Patches with tests and documentation are likely to get applied *much* sooner. :-) Note that in issue 26 values will *already* have been converted to lists if they are in list format - so doing an *additional* split on ',' is incorrect. For example this single string does *not* represent a list: value = "something, with, commas" I'm really not sure about issue 19 - only supporting # for comments was a deliberate design decision and in general I'm against making the configobj API more complex. Issue 3 has been merged into the Python 3 port. Other than these it looks like most issues could be resolved in a new release. All the best, Michael Foord -- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html |