Commit 9a0a698e authored by Jérome Perrin's avatar Jérome Perrin

dqe: fix python3 compatibility

parent 72abf369
import requests import requests
from json import loads from json import loads
from socket import timeout from socket import timeout
from requests import ConnectionError, Timeout from requests import ConnectionError as _ConnectionError, Timeout
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from urllib import urlencode from six.moves import urllib
from zLOG import LOG, INFO from zLOG import LOG, INFO
class DQEDataValidatorClientConnector(XMLObject): class DQEDataValidatorClientConnector(XMLObject):
...@@ -23,7 +23,7 @@ class DQEDataValidatorClientConnector(XMLObject): ...@@ -23,7 +23,7 @@ class DQEDataValidatorClientConnector(XMLObject):
try: try:
base_url = self.getServerUrl() + method_name + '/' base_url = self.getServerUrl() + method_name + '/'
response = requests.get(base_url, params=params, timeout=self.getTimeout()) response = requests.get(base_url, params=params, timeout=self.getTimeout())
except (Timeout, timeout, ConnectionError): except (Timeout, timeout, _ConnectionError):
raw_response = 'TIMEOUT' raw_response = 'TIMEOUT'
result_dict = {} result_dict = {}
else: else:
...@@ -41,7 +41,7 @@ class DQEDataValidatorClientConnector(XMLObject): ...@@ -41,7 +41,7 @@ class DQEDataValidatorClientConnector(XMLObject):
archiveExchange = self._getTypeBasedMethod('archiveExchange') archiveExchange = self._getTypeBasedMethod('archiveExchange')
if archiveExchange is not None: if archiveExchange is not None:
archiveExchange( 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, raw_response=raw_response,
service=service, service=service,
archive_kw=archive_kw, archive_kw=archive_kw,
......
import urlparse from six.moves import urllib
resource_value = context.getResourceValue() resource_value = context.getResourceValue()
if not resource_value.isMemberOf('http_exchange_resource/dqe'): if not resource_value.isMemberOf('http_exchange_resource/dqe'):
...@@ -7,7 +7,7 @@ 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() request = context.getRequest()
if not request: if not request:
return '' 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 dqe_resource_category = context.getPortalObject().portal_categories.http_exchange_resource.dqe
service_value_to_key_list_dict = { service_value_to_key_list_dict = {
dqe_resource_category.DefaultEmail: ('Email', ), 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