From: Noel Power Date: Fri, 13 Apr 2018 10:19:10 +0000 (+0100) Subject: python/samba: Add some compatability PY2/PY3 functions X-Git-Tag: ldb-1.4.0~509 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d2ee36e350108a226a3d3dc641a067c9eed4897d;p=thirdparty%2Fsamba.git 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 Reviewed-by: Alexander Bokovoy --- diff --git a/python/samba/compat.py b/python/samba/compat.py index 667a1a443b1..d17dc3c2ce9 100644 --- a/python/samba/compat.py +++ b/python/samba/compat.py @@ -22,8 +22,20 @@ import sys PY3 = sys.version_info[0] == 3 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, + string_types = str text_type = str else: + # compat functions + from urllib import quote as urllib_quote + from urllib import urlopen as urllib_urlopen + + # compat types integer_types = (int, long) + string_types = basestring text_type = unicode