Unfortunately, no. Without the validator, everything ConfigObj returns is a string.
However, there are some useful utility functions in weeutil.weeutil: to_int(), to_float(), and to_bool(), which take care of possible 'None' values. They are sprinkled throughout WeeWX, wherever a conversion needs to take place. -tk On Fri, Jun 7, 2019 at 7:46 AM Pat <[email protected]> wrote: > Not really weewx-centric but since weewx uses configobj, I have a question > that you may have come across before. In Belchertown skin 1.0 I've adopted > the ImageGenerator to fork and build it out for the HighchartGenerator. The > end result in my fork is the creation of a JSON file (instead of an image). > > Certain config items need to be integers but it seems that ConfigObj is > forcing strings. I've tried the integer() option > <https://configobj.readthedocs.io/en/latest/configobj.html#default-values>, > but that seems related to the Validator > <https://configobj.readthedocs.io/en/latest/configobj.html#validation> > which I'm not using because I'd have a mile-long validation ini full of > Highcharts defaults which I also don't want to manage. > > Is there a way to have ConfigObj force integer if the value is an integer? > > > -- > You received this message because you are subscribed to the Google Groups > "weewx-development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-development/bee63ee9-1e8b-4b94-8e49-92ca0a70d19a%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-development/bee63ee9-1e8b-4b94-8e49-92ca0a70d19a%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/CAPq0zEDk-z0kY_SMPkU-o0nV6xJm3hqdJgUnfY1KdztT8jemKQ%40mail.gmail.com.
