From: Noel Power Date: Wed, 5 Sep 2018 12:00:59 +0000 (+0100) Subject: python/samba/gp_parse: PY2/PY3 compat porting for gp_init.py X-Git-Tag: tdb-1.3.17~927 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf79e6ae1516a76cf8b7403a8372fbc6dc3a3a6a;p=thirdparty%2Fsamba.git python/samba/gp_parse: PY2/PY3 compat porting for gp_init.py 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 Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/gp_parse/gp_ini.py b/python/samba/gp_parse/gp_ini.py index 575dee78727..58aee88a1e1 100644 --- a/python/samba/gp_parse/gp_ini.py +++ b/python/samba/gp_parse/gp_ini.py @@ -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():