|
From: Rob D. <rd...@gm...> - 2014-10-07 03:00:50
|
Hello aps, I'm one of the current maintainers, though this is an area where I have no special experience/knowledge. I did take a look at the in-code documentation, and it appears that the code for looking for "default=<value>" is handled before it's ever passed to the check function (the custom_bar you wrote). The function in question: https://github.com/DiffSK/configobj/blob/master/validate.py#L616 have you tried adding a "default=<some_value>" to the configspec, without changing your function? On Mon, Oct 6, 2014 at 6:12 PM, pisymbol . <pis...@gm...> wrote: > Hello: > > I am trying to do the following: > > foo.spec: > > [Foo] > bar = custom_bar() > > If bar exists under Foo section, call custom_bar(). That works. > > However, if the INI file passed to ConfigObj.validate() does not contain > bar at all, the section just fails validation since looking at the source, > it seems validation is what sets the default value. > > Is there a way to write a custom check function and also have a default > value filled in similar to the built-in ones like integer's, string's, > default argument, etc.? > > I've looked high and low for an example and I can't seem to find one. > > Thanks! > > -aps > > > ------------------------------------------------------------------------------ > Slashdot TV. Videos for Nerds. Stuff that Matters. > > http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk > _______________________________________________ > Configobj-develop mailing list > Con...@li... > https://lists.sourceforge.net/lists/listinfo/configobj-develop > > |