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

Dan Smith
Thu Jul 17 20:05:35 PDT 2014


> I hadn't seen that form of string formatting before, and it makes
> this flexible approach much more reasonable. However, it doesn't
> _quite_ work because the config read seems to object to the "(name)"
> embedded in the format. Stack trace at the end if you're curious.
> I tried several forms of quoting and escaping without success.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20140717/5ff31765/attachment-0001.bin 


More information about the chirp_devel mailing list