Commit 35df6d4c authored by Jérome Perrin's avatar Jérome Perrin

dqe: fix python3 compatibility

parent d24da72e
import requests
from json import loads
from socket import timeout
from requests import ConnectionError, Timeout
from requests import ConnectionError as _ConnectionError, Timeout
from Products.ERP5Type.XMLObject import XMLObject
from urllib import urlencode
from six.moves import urllib
from zLOG import LOG, INFO
class DQEDataValidatorClientConnector(XMLObject):
......@@ -23,7 +23,7 @@ class DQEDataValidatorClientConnector(XMLObject):
try:
base_url = self.getServerUrl() + method_name + '/'
response = requests.get(base_url, params=params, timeout=self.getTimeout())
except (Timeout, timeout, ConnectionError):
except (Timeout, timeout, _ConnectionError):
raw_response = 'TIMEOUT'
result_dict = {}
else:
......@@ -41,7 +41,7 @@ class DQEDataValidatorClientConnector(XMLObject):
archiveExchange = self._getTypeBasedMethod('archiveExchange')
if archiveExchange is not None:
archiveExchange(
raw_request=base_url + '?' + urlencode(params), # XXX is this correct?
raw_request=base_url + '?' + urllib.urlparse.urlencode(params), # XXX is this correct?
raw_response=raw_response,
service=service,
archive_kw=archive_kw,
......
import urlparse
from six.moves import urllib
resource_value = context.getResourceValue()
if not resource_value.isMemberOf('http_exchange_resource/dqe'):
......@@ -7,7 +7,7 @@ if not resource_value.isMemberOf('http_exchange_resource/dqe'):
request = context.getRequest()
if not request:
return ''
query_dict = urlparse.parse_qs(urlparse.urlparse(request).query)
query_dict = urllib.urlparse.parse_qs(urllib.urlparse.urlparse(request).query)
dqe_resource_category = context.getPortalObject().portal_categories.http_exchange_resource.dqe
service_value_to_key_list_dict = {
dqe_resource_category.DefaultEmail: ('Email', ),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment