python/samba: Add some compatability PY2/PY3 functions
[samba.git] / python / samba / compat.py
index 667a1a443b1786cebf6cca6221fcbbf25764c289..d17dc3c2ce97d9eebf7689c79247866197036d34 100644 (file)
@@ -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