[chirp_devel] [developer] Control address format for full-file dump/diff - #1767

chirp.cordless at xoxy.net
Thu Jul 17 20:15:20 PDT 2014


I appreciate the explanation of how to possibly work around
the initial problem, but my proposed solution is less work, less code,
tested, just as flexible wrt to controlling the format, and results IMO
in a friendlier and more robust interface.

Did you have some reason for not liking that direction?

-dan

On Jul 17, 2014, at 8:05 PM, Dan Smith - dsmith at danplanet.com  wrote:
> ConfigParser is trying to interpolate those as other configuration
> variables. You need to pass raw=True to the get() operation. The
> wrapping around ConfigParser makes that a little tough. Apply this
> (untested change) to your tree and then pass raw=True in the get call
> and see if that solves the problem. If so, then you can just include
> this in your patch:
> 
> --- a/chirpui/config.py Mon Jul 14 20:10:30 2014 -0400
> +++ b/chirpui/config.py Thu Jul 17 20:04:23 2014 -0700
> @@ -36,14 +36,14 @@
>         self.__config.write(cfg_file)
>         cfg_file.close()
> 
> -    def get(self, key, section):
> +    def get(self, key, section, raw=False):
>         if not self.__config.has_section(section):
>             return None
> 
>         if not self.__config.has_option(section, key):
>             return None
> 
> -        return self.__config.get(section, key)
> +        return self.__config.get(section, key, raw=raw)
> 
>     def set(self, key, value, section):
>         if not self.__config.has_section(section):
> @@ -65,8 +65,9 @@
>         self._config = config
>         self._section = section
> 
> -    def get(self, key, section=None):
> -        return self._config.get(key, section or self._section)
> +    def get(self, key, section=None, raw=False):
> +        return self._config.get(key, section or self._section,
> +                                raw=False)
> 
>     def set(self, key, value, section=None):
>         return self._config.set(key, value, section or self._section)
> 
> --Dan





More information about the chirp_devel mailing list