1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

python/samba/gp_parse: PY2/PY3 compat porting for gp_init.py

Fixes
1) use compat versions of ConfigParser and StringIO
2) open file needs to be opened in binary mode as write_pretty_xml
   routine uses BytesIO() object.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Noel Power
2018-10-15 10:58:23 +01:00
committed by Andrew Bartlett
parent 600fde58ab
commit 04c118cf0e

View File

@@ -21,9 +21,9 @@ import codecs
import collections
import re
from ConfigParser import ConfigParser
from xml.etree.ElementTree import Element, SubElement
from StringIO import StringIO
from samba.compat import ConfigParser
from samba.compat import StringIO
from samba.gp_parse import GPParser, ENTITY_USER_ID
@@ -70,7 +70,7 @@ class GPIniParser(GPParser):
return section_name
def write_xml(self, filename):
with file(filename, 'w') as f:
with open(filename, 'wb') as f:
root = Element('IniFile')
for sec_ini in self.ini_conf.sections():