From: pisymbol . <pis...@gm...> - 2015-08-01 01:47:03
|
On Fri, Jul 31, 2015 at 8:08 PM, Sumit's Mailing Lists <li...@ba...> wrote: > I've been looking through the docs and StackOverflow and I'm still a > little stumped on this. Can I have an optional section in my config > specification? For example, say I had this as my configspec: > > config_specification = """ > [General] > > sample_rate = float > > [Data] > [[__many__]] > type = option('sense.xml') > [[[Identifier]]] > type = option("name", "mac", "uuid") > adapter = string(default='') > id = string(default='') > file = string(default='') > [[[Location]]] > type = option("virtual", "gps") > longitude = string(default='') > latitude = string(default='') > altitude = string(default='') > speed = string(default='') > climb = string(default='') > track = string(default='') > longutide_error = string(default='') > latitude_error = string(default='') > altitude_error = string(default='') > speed_error = string(default='') > climb_track = string(default='') > track_error = string(default='') > """ > > Is there a way to make [[[Locaiton]]] optional, so it can be missing and > still pass validation (assuming that I do validation like so): > Why not just make it non-fatal? for (section_list, key, _) in flatten_errors(config, test): if key == 'Location': pass etc. -aps |