mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
python/samba: add alias for ConfigParser for PY2/PY3 compatability
ConfigParser module changed name to configParser in PY3, additionally the behaviour regarding interpolation has changed. ConfigParser now has a default interpolation param whose behaviour demands that '%' is escaped. To maintain behaviour with the python2 version this default param needs to be changed. Add some alias(s) and 'shim' Configparser symbol in samba.compat to cater for this. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
8d7830b6fc
commit
600fde58ab
@ -83,6 +83,9 @@ if PY3:
|
||||
# alias
|
||||
import io
|
||||
StringIO = io.StringIO
|
||||
def ConfigParser(defaults=None, dict_type=None, allow_no_value=None):
|
||||
from configparser import ConfigParser
|
||||
return ConfigParser(defaults, dict_type, allow_no_value, interpolation=None)
|
||||
else:
|
||||
# Helper function to return bytes.
|
||||
# if 'unicode' is passed in then it is decoded using 'utf8' and
|
||||
@ -158,4 +161,5 @@ else:
|
||||
# alias
|
||||
import cStringIO
|
||||
StringIO = cStringIO.StringIO
|
||||
from ConfigParser import ConfigParser
|
||||
cmp_fn = cmp
|
||||
|
Loading…
x
Reference in New Issue
Block a user