Commit b790643e authored by Jérome Perrin's avatar Jérome Perrin

py3: 2to3 -j 20 --write --nobackups --no-diffs --fix=has_key master

parent e5fd9154
......@@ -44,7 +44,7 @@ length = context.getArrayShape()[0]
# never access more than 1000 lines at once
list_lines = min(list_lines, limit, 1000)
if context.REQUEST.has_key("limit"):
if "limit" in context.REQUEST:
list_start = limit[0]
list_lines = limit[1] - limit[0]
......
......@@ -308,10 +308,10 @@ class SlapOSComputeNodeMixin(object):
parameter_dict.pop('filter_xml'))
partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid')
for slave_instance_dict in parameter_dict.get("slave_instance_list", []):
if slave_instance_dict.has_key("connection_xml"):
if "connection_xml" in slave_instance_dict:
slave_instance_dict.update(self._instanceXmlToDict(
slave_instance_dict.pop("connection_xml")))
if slave_instance_dict.has_key("xml"):
if "xml" in slave_instance_dict:
slave_instance_dict.update(self._instanceXmlToDict(
slave_instance_dict.pop("xml")))
partition_dict['_parameter_dict'].update(parameter_dict)
......
......@@ -129,13 +129,13 @@ class SlapOSComputePartitionMixin(object):
parameter_dict.pop('filter_xml'))
partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid')
for slave_instance_dict in parameter_dict.get("slave_instance_list", []):
if slave_instance_dict.has_key("connection_xml"):
if "connection_xml" in slave_instance_dict:
connection_dict = software_instance._instanceXmlToDict(
slave_instance_dict.pop("connection_xml"))
slave_instance_dict.update(connection_dict)
slave_instance_dict['connection-parameter-hash'] = \
calculate_dict_hash(connection_dict)
if slave_instance_dict.has_key("xml"):
if "xml" in slave_instance_dict:
slave_instance_dict.update(software_instance._instanceXmlToDict(
slave_instance_dict.pop("xml")))
partition_dict['_parameter_dict'].update(parameter_dict)
......
......@@ -11,7 +11,7 @@ message_dict = context.getAccessStatus()
if message_dict.get("no_data", None) == 1:
message_dict = {}
if message_dict.has_key('created_at'):
if 'created_at' in message_dict:
contact_date = DateTime(message_dict.get('created_at').encode('utf-8'))
return (now_date - contact_date) < maximum_days
......
......@@ -29,9 +29,9 @@ parameter_dict = instance.getConnectionXmlAsDict()
url_string = parameter_dict.get('monitor-setup-url', '')
if url_string:
if parameter_dict.has_key('monitor-user') and \
parameter_dict.has_key('monitor-password') and \
parameter_dict.has_key('monitor-base-url'):
if 'monitor-user' in parameter_dict and \
'monitor-password' in parameter_dict and \
'monitor-base-url' in parameter_dict:
username = parameter_dict.get('monitor-user')
password = parameter_dict.get('monitor-password')
url = parameter_dict.get('monitor-base-url') + '/public/feeds'
......
......@@ -26,7 +26,7 @@ current_username = context.getPortalObject().portal_membership.getAuthenticatedM
if current_username == original_login:
# We should logout immediately
if context.REQUEST.has_key('portal_skin'):
if 'portal_skin' in context.REQUEST:
context.portal_skins.clearSkinCookie()
context.REQUEST.RESPONSE.expireCookie('__ac', path='/')
context.REQUEST.RESPONSE.expireCookie('__ac_google_hash', path='/')
......
......@@ -46,9 +46,9 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
return ''
if context.getPortalType() in ["Software Instance", "Slave Instance"]:
connection = context.getConnectionXmlAsDict()
if connection and connection.has_key('monitor-user') and \
connection.has_key('monitor-password') and \
connection.has_key('monitor-base-url'):
if connection and 'monitor-user' in connection and \
'monitor-password' in connection and \
'monitor-base-url' in connection:
return 'https://monitor.app.officejs.com/#/?username=testuser&url=softinst-monitored/public/feeds&password=testpass&page=ojsm_dispatch&query=portal_type%3A%22Software%20Instance%22%20AND%20title%3A%22Template%20Software%20Instance%22%20AND%20specialise_title%3A%22Template%20Instance%20Tree%22'
else:
return ''
......@@ -56,9 +56,9 @@ class TestSlapOSHalJsonStyleMixin(SlapOSTestCaseMixinWithAbort):
soft_inst = context.getSuccessorValue()
if soft_inst:
connection = soft_inst.getConnectionXmlAsDict()
if connection and connection.has_key('monitor-user') and \
connection.has_key('monitor-password') and \
connection.has_key('monitor-base-url'):
if connection and 'monitor-user' in connection and \
'monitor-password' in connection and \
'monitor-base-url' in connection:
return 'https://monitor.app.officejs.com/#/?username=testuser&url=softinst-monitored/public/feeds&password=testpass&page=ojsm_dispatch&query=portal_type%3A%22Instance%20Tree%22%20AND%20title%3A%22Template%20Instance%20Tree%22'
return ''
......
......@@ -14,7 +14,7 @@ def compareAndUpdateAddressList(document, address_list, additional_dict=None):
to_add_ip_dict_list.remove(current_dict)
else:
# XXX - Only delete if Network interface are supposed to be the same
if additional_dict.has_key('network_interface'):
if 'network_interface' in additional_dict:
if address.getNetworkInterface('') and additional_dict['network_interface'] != address.getNetworkInterface():
continue
to_delete_ip_id_list.append(address.getId())
......@@ -94,7 +94,7 @@ for send_partition in compute_node_dict['partition_list']:
compareAndUpdateAddressList(partition, send_partition['address_list'], {'network_interface': network_interface})
tap_addr_list = []
additional_dict = {'network_interface': 'route_' + network_interface}
if send_partition['tap'].has_key('ipv4_addr') and send_partition['tap']['ipv4_addr']:
if 'ipv4_addr' in send_partition['tap'] and send_partition['tap']['ipv4_addr']:
tap_addr_list.append({
'addr': send_partition['tap']['ipv4_addr'],
'netmask': send_partition['tap']['ipv4_netmask']
......
......@@ -128,7 +128,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
def isLiveTest(self):
#return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()]
# XXX - What is the better way to know if we are in live test mode ?
return not os.environ.has_key('TEST_CA_PATH')
return 'TEST_CA_PATH' not in os.environ
def beforeTearDown(self):
if self.abort_transaction:
......
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