diff --git a/kmip/core/attributes.py b/kmip/core/attributes.py index 0f87136..71cc0ae 100644 --- a/kmip/core/attributes.py +++ b/kmip/core/attributes.py @@ -104,14 +104,14 @@ class Name(Struct): not isinstance(self.name_value, Name.NameValue) and \ not isinstance(self.name_value, str): member = 'name_value' - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'name_value', type(Name.NameValue), type(self.name_value))) if self.name_type and \ not isinstance(self.name_type, Name.NameType) and \ not isinstance(self.name_type, str): member = 'name_type' - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'name_type', type(Name.NameType), type(self.name_type))) @@ -125,7 +125,7 @@ class Name(Struct): name = 'Name' msg = ErrorStrings.BAD_EXP_RECV member = 'name_value' - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'name_value', type(Name.NameValue), type(name_value))) @@ -137,7 +137,7 @@ class Name(Struct): name = 'Name' msg = ErrorStrings.BAD_EXP_RECV member = 'name_type' - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'name_type', type(Name.NameType), type(name_type))) @@ -357,27 +357,27 @@ class ApplicationSpecificInformation(Struct): if self.application_namespace is not None: if self.application_data is None: member = 'application_data' - raise ValueError(msg.format('{}.{}'.format(name, member), + raise ValueError(msg.format('{0}.{1}'.format(name, member), 'value', 'not None', 'None')) else: member = 'application_namespace' exp_type = self.ApplicationNamespace if not isinstance(self.application_namespace, exp_type): rcv_type = type(self.application_namespace) - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'type', exp_type, rcv_type)) if self.application_data is not None: if self.application_namespace is None: member = 'application_namespace' - raise ValueError(msg.format('{}.{}'.format(name, member), + raise ValueError(msg.format('{0}.{1}'.format(name, member), 'value', 'not None', 'None')) else: member = 'application_data' exp_type = self.ApplicationData if not isinstance(self.application_data, exp_type): rcv_type = type(self.application_data) - raise TypeError(msg.format('{}.{}'.format(name, member), + raise TypeError(msg.format('{0}.{1}'.format(name, member), 'type', exp_type, rcv_type)) @classmethod diff --git a/kmip/core/factories/attribute_values.py b/kmip/core/factories/attribute_values.py index d7c68cc..4b7ad4d 100644 --- a/kmip/core/factories/attribute_values.py +++ b/kmip/core/factories/attribute_values.py @@ -115,7 +115,7 @@ class AttributeValueFactory(object): else: if not isinstance(name, str): raise ValueError('Unrecognized attribute type: ' - '{}'.format(name)) + '{0}'.format(name)) elif name.startswith('x-'): # Custom attribute indicated value = self._create_custom_attribute(value) diff --git a/kmip/core/factories/attributes.py b/kmip/core/factories/attributes.py index 47dfdbf..48ddddb 100644 --- a/kmip/core/factories/attributes.py +++ b/kmip/core/factories/attributes.py @@ -49,7 +49,7 @@ class AttributeFactory(object): pass else: msg = utils.build_er_error(Attribute, 'name', - '{} or {}'.format('Enum', 'str'), + '{0} or {1}'.format('Enum', 'str'), type(name)) raise TypeError(msg) diff --git a/kmip/core/factories/credentials.py b/kmip/core/factories/credentials.py index 9912c5b..2ca7980 100644 --- a/kmip/core/factories/credentials.py +++ b/kmip/core/factories/credentials.py @@ -34,7 +34,7 @@ class CredentialFactory(object): elif cred_type is CredentialType.DEVICE: value = self._create_device_credential(value) else: - msg = 'Unrecognized credential type: {}' + msg = 'Unrecognized credential type: {0}' raise ValueError(msg.format(cred_type)) return self._create_credential(cred_type, value) diff --git a/kmip/core/factories/keys.py b/kmip/core/factories/keys.py index 15a49f7..b3b215b 100644 --- a/kmip/core/factories/keys.py +++ b/kmip/core/factories/keys.py @@ -64,7 +64,7 @@ class KeyFactory(object): elif key_format is KeyFormatType.TRANSPARENT_ECMQV_PUBLIC_KEY: return self._create_transparent_ecmqv_public_key(value) else: - msg = 'Unrecognized key format type: {}' + msg = 'Unrecognized key format type: {0}' raise ValueError(msg.format(key_format)) def _create_raw_key(self, value): diff --git a/kmip/demos/create.py b/kmip/demos/create.py index 04b9969..e4ef10f 100644 --- a/kmip/demos/create.py +++ b/kmip/demos/create.py @@ -64,15 +64,16 @@ if __name__ == '__main__': credential) client.close() - logger.debug('create() result status: {}'.format( + logger.debug('create() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('created object type: {}'.format(result.object_type.enum)) - logger.debug('created UUID: {}'.format(result.uuid.value)) - logger.debug('created template attribute: {}'. + logger.debug('created object type: {0}'.format( + result.object_type.enum)) + logger.debug('created UUID: {0}'.format(result.uuid.value)) + logger.debug('created template attribute: {0}'. format(result.template_attribute)) else: - logger.debug('create() result reason: {}'.format( + logger.debug('create() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('create() result message: {}'.format( + logger.debug('create() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/destroy.py b/kmip/demos/destroy.py index 91c44d9..1e1b084 100644 --- a/kmip/demos/destroy.py +++ b/kmip/demos/destroy.py @@ -65,6 +65,6 @@ if __name__ == '__main__': result = client.destroy(uuid, credential) client.close() - logger.debug('destroy() result status: {}'.format( + logger.debug('destroy() result status: {0}'.format( result.result_status.enum)) - logger.debug('destroyed UUID: {}'.format(result.uuid.value)) + logger.debug('destroyed UUID: {0}'.format(result.uuid.value)) diff --git a/kmip/demos/get.py b/kmip/demos/get.py index 38df8a8..97940ca 100644 --- a/kmip/demos/get.py +++ b/kmip/demos/get.py @@ -63,7 +63,7 @@ if __name__ == '__main__': result = client.get(uuid, credential) client.close() - logger.debug('get() result status: {}'.format(result.result_status.enum)) - logger.debug('retrieved object type: {}'.format(result.object_type.enum)) - logger.debug('retrieved UUID: {}'.format(result.uuid.value)) - logger.debug('retrieved secret: {}'.format(result.secret)) + logger.debug('get() result status: {0}'.format(result.result_status.enum)) + logger.debug('retrieved object type: {0}'.format(result.object_type.enum)) + logger.debug('retrieved UUID: {0}'.format(result.uuid.value)) + logger.debug('retrieved secret: {0}'.format(result.secret)) diff --git a/kmip/demos/locate.py b/kmip/demos/locate.py index 39cce31..f982a2f 100644 --- a/kmip/demos/locate.py +++ b/kmip/demos/locate.py @@ -71,10 +71,10 @@ if __name__ == '__main__': result = client.locate(attributes=attrs, credential=credential) client.close() - logger.debug('locate() result status: {}'. + logger.debug('locate() result status: {0}'. format(result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('retrieved object type: {}'. + logger.debug('retrieved object type: {0}'. format(result.object_type.enum)) - logger.debug('Located UUIDs: {}'.format(','.join([u.value for u in - result.uuids]))) + logger.debug('Located UUIDs: {0}'.format(','.join([u.value for u in + result.uuids]))) diff --git a/kmip/demos/register.py b/kmip/demos/register.py index e58e163..a359d21 100644 --- a/kmip/demos/register.py +++ b/kmip/demos/register.py @@ -77,8 +77,8 @@ if __name__ == '__main__': credential) client.close() - logger.debug('register() result status: {}'.format( + logger.debug('register() result status: {0}'.format( result.result_status.enum)) - logger.debug('registered UUID: {}'.format(result.uuid.value)) - logger.debug('registered template attribute: {}'. + logger.debug('registered UUID: {0}'.format(result.uuid.value)) + logger.debug('registered template attribute: {0}'. format(result.template_attribute)) diff --git a/kmip/demos/units/create.py b/kmip/demos/units/create.py index f1b6099..c0b5341 100644 --- a/kmip/demos/units/create.py +++ b/kmip/demos/units/create.py @@ -120,17 +120,17 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('create() result status: {}'.format( + logger.debug('create() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('created object type: {}'.format( + logger.debug('created object type: {0}'.format( result.object_type.enum)) - logger.debug('created UUID: {}'.format(result.uuid.value)) - logger.debug('created template attribute: {}'. + logger.debug('created UUID: {0}'.format(result.uuid.value)) + logger.debug('created template attribute: {0}'. format(result.template_attribute)) else: - logger.debug('create() result reason: {}'.format( + logger.debug('create() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('create() result message: {}'.format( + logger.debug('create() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/create_key_pair.py b/kmip/demos/units/create_key_pair.py index 4a09ffd..cbbe612 100644 --- a/kmip/demos/units/create_key_pair.py +++ b/kmip/demos/units/create_key_pair.py @@ -113,20 +113,20 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('create_key_pair() result status: {}'.format( + logger.debug('create_key_pair() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('created private key UUID: {}'.format( + logger.debug('created private key UUID: {0}'.format( result.private_key_uuid)) - logger.debug('created public key UUID: {}'.format( + logger.debug('created public key UUID: {0}'.format( result.public_key_uuid)) - logger.debug('created private key template attribute: {}'.format( + logger.debug('created private key template attribute: {0}'.format( result.private_key_template_attribute)) - logger.debug('created public key template attribute: {}'.format( + logger.debug('created public key template attribute: {0}'.format( result.public_key_template_attribute)) else: - logger.debug('create() result reason: {}'.format( + logger.debug('create() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('create() result message: {}'.format( + logger.debug('create() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/destroy.py b/kmip/demos/units/destroy.py index 40b81e4..d85e022 100644 --- a/kmip/demos/units/destroy.py +++ b/kmip/demos/units/destroy.py @@ -71,13 +71,13 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('destroy() result status: {}'.format( + logger.debug('destroy() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('destroyed UUID: {}'.format(result.uuid.value)) + logger.debug('destroyed UUID: {0}'.format(result.uuid.value)) else: - logger.debug('destroy() result reason: {}'.format( + logger.debug('destroy() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('destroy() result message: {}'.format( + logger.debug('destroy() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/discover_versions.py b/kmip/demos/units/discover_versions.py index 4eac19c..0d3a1e9 100644 --- a/kmip/demos/units/discover_versions.py +++ b/kmip/demos/units/discover_versions.py @@ -47,7 +47,7 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('discover_versions() result status: {}'.format( + logger.debug('discover_versions() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: @@ -61,7 +61,7 @@ if __name__ == '__main__': else: logger.debug('number of protocol versions returned: 0') else: - logger.debug('discover_versions() result reason: {}'.format( + logger.debug('discover_versions() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('discover_versions() result message: {}'.format( + logger.debug('discover_versions() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/get.py b/kmip/demos/units/get.py index 53559d6..03643f0 100644 --- a/kmip/demos/units/get.py +++ b/kmip/demos/units/get.py @@ -71,16 +71,16 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('get() result status: {}'.format( + logger.debug('get() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('retrieved object type: {}'.format( + logger.debug('retrieved object type: {0}'.format( result.object_type.enum)) - logger.debug('retrieved UUID: {}'.format(result.uuid.value)) - logger.debug('retrieved secret: {}'.format(result.secret)) + logger.debug('retrieved UUID: {0}'.format(result.uuid.value)) + logger.debug('retrieved secret: {0}'.format(result.secret)) else: - logger.debug('get() result reason: {}'.format( + logger.debug('get() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('get() result message: {}'.format( + logger.debug('get() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/locate.py b/kmip/demos/units/locate.py index 8ac2635..9c3c4e1 100644 --- a/kmip/demos/units/locate.py +++ b/kmip/demos/units/locate.py @@ -86,7 +86,7 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('locate() result status: {}'.format( + logger.debug('locate() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: @@ -94,7 +94,7 @@ if __name__ == '__main__': for uuid in result.uuids: logging.debug('{0}'.format(uuid)) else: - logger.debug('get() result reason: {}'.format( + logger.debug('get() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('get() result message: {}'.format( + logger.debug('get() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/demos/units/register.py b/kmip/demos/units/register.py index c2a40ab..c773324 100644 --- a/kmip/demos/units/register.py +++ b/kmip/demos/units/register.py @@ -121,15 +121,15 @@ if __name__ == '__main__': client.close() # Display operation results - logger.debug('register() result status: {}'.format( + logger.debug('register() result status: {0}'.format( result.result_status.enum)) if result.result_status.enum == ResultStatus.SUCCESS: - logger.debug('registered UUID: {}'.format(result.uuid.value)) - logger.debug('registered template attribute: {}'. + logger.debug('registered UUID: {0}'.format(result.uuid.value)) + logger.debug('registered template attribute: {0}'. format(result.template_attribute)) else: - logger.debug('register() result reason: {}'.format( + logger.debug('register() result reason: {0}'.format( result.result_reason.enum)) - logger.debug('register() result message: {}'.format( + logger.debug('register() result message: {0}'.format( result.result_message.value)) diff --git a/kmip/services/processor.py b/kmip/services/processor.py index 9522136..ead0770 100644 --- a/kmip/services/processor.py +++ b/kmip/services/processor.py @@ -121,7 +121,7 @@ class Processor(object): elif result_status.enum is RS.OPERATION_UNDONE: result_reason = result[1] else: - msg = 'Unrecognized operation result status: {}' + msg = 'Unrecognized operation result status: {0}' raise RuntimeError(msg.format(result_status)) resp_bi = ResponseBatchItem(operation=operation, @@ -144,7 +144,7 @@ class Processor(object): elif batch_error_cont_option.enum is BECO.CONTINUE: continue else: - msg = 'Unrecognized batch error continuation option: {}' + msg = 'Unrecognized batch error continuation option: {0}' raise RuntimeError(msg.format(batch_error_cont_option)) response_batch_count = BatchCount(len(response_batch_items))