python/samba/gp_parse: PY2/PY3 compat porting for gp_init.py
authorNoel Power <noel.power@suse.com>
Wed, 5 Sep 2018 12:00:59 +0000 (13:00 +0100)
committerNoel Power <npower@samba.org>
Mon, 5 Nov 2018 19:05:23 +0000 (20:05 +0100)
Fixes
1) use compat versions of ConfigParser and StringIO
2) fix sort list of XML Elements
3) open file needs to be opened in binary mode as write_pretty_xml
   routing uses BytesIO() object.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gp_parse/gp_ini.py

index 575dee78727f1fdd19c5de95e1b640a05fa8023b..58aee88a1e1de3add1a73d7c7e4fc25eb6037dbc 100644 (file)
@@ -70,7 +70,7 @@ class GPIniParser(GPParser):
         return section_name
 
     def write_xml(self, filename):
-        with open(filename, 'w') as f:
+        with open(filename, 'wb') as f:
             root = Element('IniFile')
 
             for sec_ini in self.ini_conf.sections():