mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
python/samba: Add some compatability PY2/PY3 functions
I hope these changes are a short term interim solution for the absence of the 'six' module/library. I also hope that soon this module can be removed and be replaced by usage of six. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
@ -22,8 +22,20 @@ import sys
|
|||||||
PY3 = sys.version_info[0] == 3
|
PY3 = sys.version_info[0] == 3
|
||||||
|
|
||||||
if PY3:
|
if PY3:
|
||||||
|
# compat functions
|
||||||
|
from urllib.parse import quote as urllib_quote
|
||||||
|
from urllib.request import urlopen as urllib_urlopen
|
||||||
|
|
||||||
|
# compat types
|
||||||
integer_types = int,
|
integer_types = int,
|
||||||
|
string_types = str
|
||||||
text_type = str
|
text_type = str
|
||||||
else:
|
else:
|
||||||
|
# compat functions
|
||||||
|
from urllib import quote as urllib_quote
|
||||||
|
from urllib import urlopen as urllib_urlopen
|
||||||
|
|
||||||
|
# compat types
|
||||||
integer_types = (int, long)
|
integer_types = (int, long)
|
||||||
|
string_types = basestring
|
||||||
text_type = unicode
|
text_type = unicode
|
||||||
|
Reference in New Issue
Block a user