Commit 12de24fa authored by Rafael Monnerat's avatar Rafael Monnerat

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

parent 9e48f352
...@@ -44,7 +44,7 @@ length = context.getArrayShape()[0] ...@@ -44,7 +44,7 @@ length = context.getArrayShape()[0]
# never access more than 1000 lines at once # never access more than 1000 lines at once
list_lines = min(list_lines, limit, 1000) list_lines = min(list_lines, limit, 1000)
if context.REQUEST.has_key("limit"): if "limit" in context.REQUEST:
list_start = limit[0] list_start = limit[0]
list_lines = limit[1] - limit[0] list_lines = limit[1] - limit[0]
......
...@@ -306,10 +306,10 @@ class SlapOSComputeNodeMixin(object): ...@@ -306,10 +306,10 @@ class SlapOSComputeNodeMixin(object):
parameter_dict.pop('filter_xml')) parameter_dict.pop('filter_xml'))
partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid') partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid')
for slave_instance_dict in parameter_dict.get("slave_instance_list", []): 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.update(self._instanceXmlToDict(
slave_instance_dict.pop("connection_xml"))) 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.update(self._instanceXmlToDict(
slave_instance_dict.pop("xml"))) slave_instance_dict.pop("xml")))
partition_dict['_parameter_dict'].update(parameter_dict) partition_dict['_parameter_dict'].update(parameter_dict)
......
...@@ -129,13 +129,13 @@ class SlapOSComputePartitionMixin(object): ...@@ -129,13 +129,13 @@ class SlapOSComputePartitionMixin(object):
parameter_dict.pop('filter_xml')) parameter_dict.pop('filter_xml'))
partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid') partition_dict['_instance_guid'] = parameter_dict.pop('instance_guid')
for slave_instance_dict in parameter_dict.get("slave_instance_list", []): 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( connection_dict = software_instance._instanceXmlToDict(
slave_instance_dict.pop("connection_xml")) slave_instance_dict.pop("connection_xml"))
slave_instance_dict.update(connection_dict) slave_instance_dict.update(connection_dict)
slave_instance_dict['connection-parameter-hash'] = \ slave_instance_dict['connection-parameter-hash'] = \
calculate_dict_hash(connection_dict) 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.update(software_instance._instanceXmlToDict(
slave_instance_dict.pop("xml"))) slave_instance_dict.pop("xml")))
partition_dict['_parameter_dict'].update(parameter_dict) partition_dict['_parameter_dict'].update(parameter_dict)
......
...@@ -10,7 +10,7 @@ message_dict = context.getAccessStatus() ...@@ -10,7 +10,7 @@ message_dict = context.getAccessStatus()
if message_dict.get("no_data", None) == 1: if message_dict.get("no_data", None) == 1:
message_dict = {} 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')) contact_date = DateTime(message_dict.get('created_at').encode('utf-8'))
return (now_date - contact_date) < maximum_days return (now_date - contact_date) < maximum_days
......
...@@ -29,9 +29,9 @@ parameter_dict = instance.getConnectionXmlAsDict() ...@@ -29,9 +29,9 @@ parameter_dict = instance.getConnectionXmlAsDict()
url_string = parameter_dict.get('monitor-setup-url', '') url_string = parameter_dict.get('monitor-setup-url', '')
if url_string: if url_string:
if parameter_dict.has_key('monitor-user') and \ if 'monitor-user' in parameter_dict and \
parameter_dict.has_key('monitor-password') and \ 'monitor-password' in parameter_dict and \
parameter_dict.has_key('monitor-base-url'): 'monitor-base-url' in parameter_dict:
username = parameter_dict.get('monitor-user') username = parameter_dict.get('monitor-user')
password = parameter_dict.get('monitor-password') password = parameter_dict.get('monitor-password')
url = parameter_dict.get('monitor-base-url') + '/public/feeds' url = parameter_dict.get('monitor-base-url') + '/public/feeds'
......
...@@ -26,7 +26,7 @@ current_username = context.getPortalObject().portal_membership.getAuthenticatedM ...@@ -26,7 +26,7 @@ current_username = context.getPortalObject().portal_membership.getAuthenticatedM
if current_username == original_login: if current_username == original_login:
# We should logout immediately # We should logout immediately
if context.REQUEST.has_key('portal_skin'): if 'portal_skin' in context.REQUEST:
context.portal_skins.clearSkinCookie() context.portal_skins.clearSkinCookie()
context.REQUEST.RESPONSE.expireCookie('__ac', path='/') context.REQUEST.RESPONSE.expireCookie('__ac', path='/')
context.REQUEST.RESPONSE.expireCookie('__ac_google_hash', path='/') context.REQUEST.RESPONSE.expireCookie('__ac_google_hash', path='/')
......
...@@ -14,7 +14,7 @@ def compareAndUpdateAddressList(document, address_list, additional_dict=None): ...@@ -14,7 +14,7 @@ def compareAndUpdateAddressList(document, address_list, additional_dict=None):
to_add_ip_dict_list.remove(current_dict) to_add_ip_dict_list.remove(current_dict)
else: else:
# XXX - Only delete if Network interface are supposed to be the same # 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(): if address.getNetworkInterface('') and additional_dict['network_interface'] != address.getNetworkInterface():
continue continue
to_delete_ip_id_list.append(address.getId()) to_delete_ip_id_list.append(address.getId())
...@@ -94,7 +94,7 @@ for send_partition in compute_node_dict['partition_list']: ...@@ -94,7 +94,7 @@ for send_partition in compute_node_dict['partition_list']:
compareAndUpdateAddressList(partition, send_partition['address_list'], {'network_interface': network_interface}) compareAndUpdateAddressList(partition, send_partition['address_list'], {'network_interface': network_interface})
tap_addr_list = [] tap_addr_list = []
additional_dict = {'network_interface': 'route_' + network_interface} 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({ tap_addr_list.append({
'addr': send_partition['tap']['ipv4_addr'], 'addr': send_partition['tap']['ipv4_addr'],
'netmask': send_partition['tap']['ipv4_netmask'] 'netmask': send_partition['tap']['ipv4_netmask']
......
...@@ -138,7 +138,7 @@ class testSlapOSMixin(ERP5TypeTestCase): ...@@ -138,7 +138,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
def isLiveTest(self): def isLiveTest(self):
#return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()] #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 ? # 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): def beforeTearDown(self):
if self.abort_transaction: 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