Re: [Rest2web-develop] None and Defaults
Brought to you by:
mjfoord
From: Michael F. <mi...@pc...> - 2005-08-16 15:02:12
|
Commit done anyway - minor changes to ConfigObj and validate. Michael Foord wrote: > Hello Nicola, > > About to commit a few minor changes to ConfigObj. > > I have a question about your changes to validate regarding None : > > Specifically this code : > if missing: > try: > value = fun_kwargs['default'] > except KeyError: > raise ValidateMissingValue > # None is an admissible value for all types > if isinstance(value, StringTypes) and (value.lower() == 'none'): > return None > > This means that the string 'none' in a value will *always* be converted > to ``None``. I think this should only happen if 'none' is the default > value and the value itself is missing. > > Also - in case validate is called later ``None`` ought to always go > through (e.g. to verify user changes to the config file made via a GUI). > > These two changes make the code (I think) : > > if missing: > try: > value = fun_kwargs['default'] > except KeyError: > raise ValidateMissingValue > # None is an admissible value for all types > if isinstance(value, StringTypes) and (value.lower() == 'none'): > value = None > if value is None: > return None > > Fuzzy > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Rest2web-develop mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/rest2web-develop > > > |