py2/py3: stop using deprecated urllib.split* functions.
Showing
... | @@ -61,7 +61,7 @@ from Products.PythonScripts.PythonScript import PythonScript | ... | @@ -61,7 +61,7 @@ from Products.PythonScripts.PythonScript import PythonScript |
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter | from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter | ||
from Products.ERP5Form.PreferenceTool import Priority | from Products.ERP5Form.PreferenceTool import Priority | ||
from zLOG import LOG, DEBUG | from zLOG import LOG, DEBUG | ||
from Products.ERP5Type.Utils import convertToUpperCase | from Products.ERP5Type.Utils import convertToUpperCase, str2bytes | ||
from Products.ERP5Type.tests.backportUnittest import SetupSiteError | from Products.ERP5Type.tests.backportUnittest import SetupSiteError | ||
from Products.ERP5Type.tests.utils import addUserToDeveloperRole | from Products.ERP5Type.tests.utils import addUserToDeveloperRole | ||
from Products.ERP5Type.tests.utils import parseListeningAddress | from Products.ERP5Type.tests.utils import parseListeningAddress | ||
... | @@ -590,17 +590,18 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): | ... | @@ -590,17 +590,18 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase): |
bt5_path_list += [os.path.join(path, "*") for path in bt5_path_list] | bt5_path_list += [os.path.join(path, "*") for path in bt5_path_list] | ||
def search(path, template): | def search(path, template): | ||
urltype, url = urllib.splittype(path + '/' + template) | parsed_url = six.moves.urllib.parse.urlparse(path + '/' + template) | ||
if urltype == 'http': | if parsed_url.scheme == 'http': | ||
host, selector = urllib.splithost(url) | user = parsed_url.username | ||
user_passwd, host = urllib.splituser(host) | password = parsed_url.password | ||
host = urllib.unquote(host) | host = parsed_url.hostname | ||
h = httplib.HTTP(host) | selector = parsed_url.path | ||
h = http_client.HTTP(host) | |||
|
|||
h.putrequest('HEAD', selector) | h.putrequest('HEAD', selector) | ||
h.putheader('Host', host) | h.putheader('Host', host) | ||
if user_passwd: | if user and passwd: | ||
|
|||
h.putheader('Authorization', | h.putheader('Authorization', | ||
'Basic %s' % base64.b64encode(user_passwd).strip()) | 'Basic %s' % base64.b64encode(str2bytes('%s:%s' % (user, passwd))).strip()) | ||
h.endheaders() | h.endheaders() | ||
errcode, errmsg, headers = h.getreply() | errcode, errmsg, headers = h.getreply() | ||
if errcode == 200: | if errcode == 200: | ||
... | @@ -1313,7 +1314,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): | ... | @@ -1313,7 +1314,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): |
sql = kw.get('erp5_sql_connection_string') | sql = kw.get('erp5_sql_connection_string') | ||
if sql: | if sql: | ||
app[portal_name]._setProperty('erp5_site_global_id', | app[portal_name]._setProperty('erp5_site_global_id', | ||
base64.standard_b64encode(sql)) | base64.standard_b64encode(str2bytes(sql))) | ||
if not quiet: | if not quiet: | ||
ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start)) | ZopeTestCase._print('done (%.3fs)\n' % (time.time() - _start)) | ||
# Release locks | # Release locks | ||
... | ... |