diff options
author | Zuul <zuul@review.opendev.org> | 2021-02-17 14:59:31 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-02-17 14:59:31 +0000 |
commit | 6f0370848615c7ca0306cf1ae7bf3f1118072a69 (patch) | |
tree | 3c068e79794432edb5f23ec2f005dd33c5126545 /openstack_dashboard/dashboards | |
parent | ef034dda0036e8830e43a8b079486caeb6cb24e9 (diff) | |
parent | 87f498bee50be714c26dca449802dad012ddbac4 (diff) | |
download | horizon-6f0370848615c7ca0306cf1ae7bf3f1118072a69.tar.gz |
Merge "Drop the usage of unicode prefix from unicode strings"
Diffstat (limited to 'openstack_dashboard/dashboards')
56 files changed, 581 insertions, 583 deletions
diff --git a/openstack_dashboard/dashboards/admin/aggregates/tables.py b/openstack_dashboard/dashboards/admin/aggregates/tables.py index 443773232..fd27d0d3e 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/tables.py +++ b/openstack_dashboard/dashboards/admin/aggregates/tables.py @@ -26,16 +26,16 @@ class DeleteAggregateAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Host Aggregate", - u"Delete Host Aggregates", + "Delete Host Aggregate", + "Delete Host Aggregates", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Host Aggregate", - u"Deleted Host Aggregates", + "Deleted Host Aggregate", + "Deleted Host Aggregates", count ) diff --git a/openstack_dashboard/dashboards/admin/aggregates/tests.py b/openstack_dashboard/dashboards/admin/aggregates/tests.py index 20a0360b9..2b6d66da2 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/tests.py +++ b/openstack_dashboard/dashboards/admin/aggregates/tests.py @@ -104,7 +104,7 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): workflow_data['name'] = '' workflow_data['availability_zone'] = '' self._test_generic_create_aggregate(workflow_data, aggregate, (), 1, - u'This field is required') + 'This field is required') def test_create_aggregate_fails_missing_fields_existing_aggregates(self): aggregate = self.aggregates.first() @@ -115,14 +115,14 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): self._test_generic_create_aggregate(workflow_data, aggregate, existing_aggregates, 1, - u'This field is required') + 'This field is required') def test_create_aggregate_fails_duplicated_name(self): aggregate = self.aggregates.first() existing_aggregates = self.aggregates.list() workflow_data = self._get_create_workflow_data(aggregate) expected_error_message = html \ - .escape(u'The name "%s" is already used by another host aggregate.' + .escape('The name "%s" is already used by another host aggregate.' % aggregate.name) self._test_generic_create_aggregate(workflow_data, aggregate, @@ -254,7 +254,7 @@ class AggregatesViewTests(test.BaseAdminViewTests): 'availability_zone': aggregate.availability_zone} self._test_generic_update_aggregate(form_data, aggregate, 1, - u'This field is required') + 'This field is required') def test_update_aggregate_fails_missing_az_field(self): aggregate = self.aggregates.first() @@ -264,7 +264,7 @@ class AggregatesViewTests(test.BaseAdminViewTests): self._test_generic_update_aggregate( form_data, aggregate, 1, - u'The new availability zone can't be empty') + 'The new availability zone can't be empty') class ManageHostsTests(test.BaseAdminViewTests): diff --git a/openstack_dashboard/dashboards/admin/flavors/tables.py b/openstack_dashboard/dashboards/admin/flavors/tables.py index 4cdf680c5..731249b0e 100644 --- a/openstack_dashboard/dashboards/admin/flavors/tables.py +++ b/openstack_dashboard/dashboards/admin/flavors/tables.py @@ -34,16 +34,16 @@ class DeleteFlavor(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Flavor", - u"Delete Flavors", + "Delete Flavor", + "Delete Flavors", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Flavor", - u"Deleted Flavors", + "Deleted Flavor", + "Deleted Flavors", count ) diff --git a/openstack_dashboard/dashboards/admin/group_types/specs/tables.py b/openstack_dashboard/dashboards/admin/group_types/specs/tables.py index a5cabed77..6daf4abfd 100644 --- a/openstack_dashboard/dashboards/admin/group_types/specs/tables.py +++ b/openstack_dashboard/dashboards/admin/group_types/specs/tables.py @@ -26,16 +26,16 @@ class GroupTypeSpecDelete(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Spec", - u"Delete Specs", + "Delete Spec", + "Delete Specs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Delete Spec", - u"Delete Specs", + "Delete Spec", + "Delete Specs", count ) diff --git a/openstack_dashboard/dashboards/admin/group_types/specs/tests.py b/openstack_dashboard/dashboards/admin/group_types/specs/tests.py index 3dac5afcb..17ecaf458 100644 --- a/openstack_dashboard/dashboards/admin/group_types/specs/tests.py +++ b/openstack_dashboard/dashboards/admin/group_types/specs/tests.py @@ -64,8 +64,8 @@ class GroupTypeSpecTests(test.BaseAdminViewTests): index_url = reverse( 'horizon:admin:group_types:index') - data = {'key': u'k1', - 'value': u'v1'} + data = {'key': 'k1', + 'value': 'v1'} self.mock_group_type_spec_set.return_value = None resp = self.client.post(create_url, data) @@ -101,7 +101,7 @@ class GroupTypeSpecTests(test.BaseAdminViewTests): args=[group_type.id, key]) index_url = reverse('horizon:admin:group_types:index') - data = {'value': u'v1'} + data = {'value': 'v1'} specs = {key: data['value']} self.mock_group_type_spec_list.return_value = specs diff --git a/openstack_dashboard/dashboards/admin/group_types/tables.py b/openstack_dashboard/dashboards/admin/group_types/tables.py index 86792d117..ee492fa20 100644 --- a/openstack_dashboard/dashboards/admin/group_types/tables.py +++ b/openstack_dashboard/dashboards/admin/group_types/tables.py @@ -63,16 +63,16 @@ class DeleteGroupType(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Group Type", - u"Delete Group Types", + "Delete Group Type", + "Delete Group Types", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Group Type", - u"Deleted Group Types", + "Deleted Group Type", + "Deleted Group Types", count ) policy_rules = (("volume", "group:group_types_manage"),) diff --git a/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py b/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py index bc085bc76..8564f16d4 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/compute/tables.py @@ -55,16 +55,16 @@ class EnableService(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Enable Service", - u"Enable Services", + "Enable Service", + "Enable Services", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Enabled Service", - u"Enabled Services", + "Enabled Service", + "Enabled Services", count ) @@ -103,13 +103,11 @@ class ComputeHostTable(tables.DataTable): ) STATUS_DISPLAY_CHOICES = ( ("enabled", pgettext_lazy("Current status of a Hypervisor", - u"Enabled")), + "Enabled")), ("disabled", pgettext_lazy("Current status of a Hypervisor", - u"Disabled")), - ("up", pgettext_lazy("Current state of a Hypervisor", - u"Up")), - ("down", pgettext_lazy("Current state of a Hypervisor", - u"Down")), + "Disabled")), + ("up", pgettext_lazy("Current state of a Hypervisor", "Up")), + ("down", pgettext_lazy("Current state of a Hypervisor", "Down")), ) host = tables.WrappingColumn('host', verbose_name=_('Host')) diff --git a/openstack_dashboard/dashboards/admin/info/tables.py b/openstack_dashboard/dashboards/admin/info/tables.py index 22543a5cb..d9be29697 100644 --- a/openstack_dashboard/dashboards/admin/info/tables.py +++ b/openstack_dashboard/dashboards/admin/info/tables.py @@ -111,7 +111,7 @@ class NovaServicesTable(tables.DataTable): updated_at = tables.Column('updated_at', verbose_name=pgettext_lazy( 'Time since the last update', - u'Last Updated'), + 'Last Updated'), filters=(utils_filters.parse_isotime, filters.timesince)) @@ -135,7 +135,7 @@ class CinderServicesTable(tables.DataTable): updated_at = tables.Column('updated_at', verbose_name=pgettext_lazy( 'Time since the last update', - u'Last Updated'), + 'Last Updated'), filters=(utils_filters.parse_isotime, filters.timesince)) @@ -209,7 +209,7 @@ class NetworkAgentsTable(tables.DataTable): heartbeat_timestamp = tables.Column('heartbeat_timestamp', verbose_name=pgettext_lazy( 'Time since the last update', - u'Last Updated'), + 'Last Updated'), filters=(utils_filters.parse_isotime, filters.timesince)) diff --git a/openstack_dashboard/dashboards/admin/instances/tables.py b/openstack_dashboard/dashboards/admin/instances/tables.py index 3bb147cc7..4cdc13121 100644 --- a/openstack_dashboard/dashboards/admin/instances/tables.py +++ b/openstack_dashboard/dashboards/admin/instances/tables.py @@ -56,16 +56,16 @@ class MigrateInstance(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Migrate Instance", - u"Migrate Instances", + "Migrate Instance", + "Migrate Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled migration (pending confirmation) of Instance", - u"Scheduled migration (pending confirmation) of Instances", + "Scheduled migration (pending confirmation) of Instance", + "Scheduled migration (pending confirmation) of Instances", count ) diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/tables.py b/openstack_dashboard/dashboards/admin/metadata_defs/tables.py index 0b5a3e649..0625cac7a 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/tables.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/tables.py @@ -44,16 +44,16 @@ class DeleteNamespace(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Namespace", - u"Delete Namespaces", + "Delete Namespace", + "Delete Namespaces", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Namespace", - u"Deleted Namespaces", + "Deleted Namespace", + "Deleted Namespaces", count ) diff --git a/openstack_dashboard/dashboards/admin/networks/agents/tables.py b/openstack_dashboard/dashboards/admin/networks/agents/tables.py index b8961929a..da8c7beb6 100644 --- a/openstack_dashboard/dashboards/admin/networks/agents/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/agents/tables.py @@ -32,16 +32,16 @@ class DeleteDHCPAgent(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete DHCP Agent", - u"Delete DHCP Agents", + "Delete DHCP Agent", + "Delete DHCP Agents", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted DHCP Agent", - u"Deleted DHCP Agents", + "Deleted DHCP Agent", + "Deleted DHCP Agents", count ) diff --git a/openstack_dashboard/dashboards/admin/networks/tables.py b/openstack_dashboard/dashboards/admin/networks/tables.py index 9af7cfdc8..ed3b9d70f 100644 --- a/openstack_dashboard/dashboards/admin/networks/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/tables.py @@ -69,8 +69,8 @@ class CreateSubnet(project_tables.CreateSubnet): DISPLAY_CHOICES = ( - ("up", pgettext_lazy("Admin state of a Network", u"UP")), - ("down", pgettext_lazy("Admin state of a Network", u"DOWN")), + ("up", pgettext_lazy("Admin state of a Network", "UP")), + ("down", pgettext_lazy("Admin state of a Network", "DOWN")), ) diff --git a/openstack_dashboard/dashboards/admin/overview/tests.py b/openstack_dashboard/dashboards/admin/overview/tests.py index 054488828..f53624d06 100644 --- a/openstack_dashboard/dashboards/admin/overview/tests.py +++ b/openstack_dashboard/dashboards/admin/overview/tests.py @@ -78,7 +78,7 @@ class UsageViewTests(test.BaseAdminViewTests): self.assertEqual(nova_stu_enabled, res.context['simple_tenant_usage_enabled']) - usage_table = encoding.smart_str(u''' + usage_table = encoding.smart_str(''' <tr class="" data-object-id="1" id="global_usage__row__1"> <td class="sortable normal_column">test_tenant</td> <td class="sortable normal_column">%s</td> @@ -97,7 +97,7 @@ class UsageViewTests(test.BaseAdminViewTests): ) # test for deleted project - usage_table_deleted = encoding.smart_str(u''' + usage_table_deleted = encoding.smart_str(''' <tr class="" data-object-id="3" id="global_usage__row__3"> <td class="sortable normal_column">3 (Deleted)</td> <td class="sortable normal_column">%s</td> @@ -168,7 +168,7 @@ class UsageViewTests(test.BaseAdminViewTests): if nova_stu_enabled: for obj in usage_obj: - row = u'"{0}","{1}","{2}","{3}","{4:.2f}"\r\n'.format( + row = '"{0}","{1}","{2}","{3}","{4:.2f}"\r\n'.format( obj.project_name, obj.vcpus, obj.memory_mb, diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/tables.py b/openstack_dashboard/dashboards/admin/rbac_policies/tables.py index 5298b3e72..5aad054c0 100644 --- a/openstack_dashboard/dashboards/admin/rbac_policies/tables.py +++ b/openstack_dashboard/dashboards/admin/rbac_policies/tables.py @@ -36,16 +36,16 @@ class DeleteRBACPolicy(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete RBAC Policy", - u"Delete RBAC Policies", + "Delete RBAC Policy", + "Delete RBAC Policies", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted RBAC Policy", - u"Deleted RBAC Policies", + "Deleted RBAC Policy", + "Deleted RBAC Policies", count ) diff --git a/openstack_dashboard/dashboards/admin/volume_types/extras/tables.py b/openstack_dashboard/dashboards/admin/volume_types/extras/tables.py index 1e6714cb4..843372b9b 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/extras/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_types/extras/tables.py @@ -24,16 +24,16 @@ class ExtraSpecDelete(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Extra Spec", - u"Delete Extra Specs", + "Delete Extra Spec", + "Delete Extra Specs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Extra Spec", - u"Deleted Extra Specs", + "Deleted Extra Spec", + "Deleted Extra Specs", count ) diff --git a/openstack_dashboard/dashboards/admin/volume_types/extras/tests.py b/openstack_dashboard/dashboards/admin/volume_types/extras/tests.py index caf038bfa..42c8cff74 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/extras/tests.py +++ b/openstack_dashboard/dashboards/admin/volume_types/extras/tests.py @@ -65,8 +65,8 @@ class VolTypeExtrasTests(test.BaseAdminViewTests): 'horizon:admin:volume_types:extras:index', args=[vol_type.id]) - data = {'key': u'k1', - 'value': u'v1'} + data = {'key': 'k1', + 'value': 'v1'} self.mock_volume_type_extra_set.return_value = None resp = self.client.post(create_url, data) @@ -103,7 +103,7 @@ class VolTypeExtrasTests(test.BaseAdminViewTests): index_url = reverse('horizon:admin:volume_types:extras:index', args=[vol_type.id]) - data = {'value': u'v1'} + data = {'value': 'v1'} extras = {key: data['value']} self.mock_volume_type_extra_get.return_value = extras diff --git a/openstack_dashboard/dashboards/admin/volume_types/forms.py b/openstack_dashboard/dashboards/admin/volume_types/forms.py index b306d8dc0..c73777b12 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/forms.py +++ b/openstack_dashboard/dashboards/admin/volume_types/forms.py @@ -112,7 +112,7 @@ class CreateVolumeTypeEncryption(forms.SelfHandlingForm): def handle(self, request, data): try: # Set Cipher to None if empty - if data['cipher'] == u'': + if data['cipher'] == '': data['cipher'] = None volume_type_id = data.pop('volume_type_id') @@ -138,7 +138,7 @@ class UpdateVolumeTypeEncryption(CreateVolumeTypeEncryption): def handle(self, request, data): try: # Set Cipher to None if empty - if data['cipher'] == u'': + if data['cipher'] == '': data['cipher'] = None volume_type_id = data.pop('volume_type_id') diff --git a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py index edd60dab0..6164a175a 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py @@ -38,16 +38,16 @@ class SpecDeleteKeyValuePair(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Spec", - u"Delete Specs", + "Delete Spec", + "Delete Specs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Spec", - u"Deleted Specs", + "Deleted Spec", + "Deleted Specs", count ) diff --git a/openstack_dashboard/dashboards/admin/volume_types/tables.py b/openstack_dashboard/dashboards/admin/volume_types/tables.py index d530fc38a..85dda38f0 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_types/tables.py @@ -75,16 +75,16 @@ class DeleteVolumeType(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Volume Type", - u"Delete Volume Types", + "Delete Volume Type", + "Delete Volume Types", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Volume Type", - u"Deleted Volume Types", + "Deleted Volume Type", + "Deleted Volume Types", count ) policy_rules = (("volume", "volume_extension:types_manage"),) @@ -126,16 +126,16 @@ class DeleteVolumeTypeEncryption(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Encryption", - u"Delete Encryptions", + "Delete Encryption", + "Delete Encryptions", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Encryption", - u"Deleted Encryptions", + "Deleted Encryption", + "Deleted Encryptions", count ) @@ -293,16 +293,16 @@ class DeleteQosSpecs(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete QoS Spec", - u"Delete QoS Specs", + "Delete QoS Spec", + "Delete QoS Specs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted QoS Spec", - u"Deleted QoS Specs", + "Deleted QoS Spec", + "Deleted QoS Specs", count ) policy_rules = (("volume", "volume_extension:types_manage"),) diff --git a/openstack_dashboard/dashboards/admin/volume_types/tests.py b/openstack_dashboard/dashboards/admin/volume_types/tests.py index fb6a734e2..24114e66b 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/tests.py +++ b/openstack_dashboard/dashboards/admin/volume_types/tests.py @@ -170,13 +170,13 @@ class VolumeTypeTests(test.BaseAdminViewTests): def test_create_volume_type_encryption(self): volume_type1 = self.cinder_volume_types.list()[0] volume_type2 = self.cinder_volume_types.list()[1] - volume_type1.id = u'1' - volume_type2.id = u'2' + volume_type1.id = '1' + volume_type2.id = '2' volume_type_list = [volume_type1, volume_type2] - formData = {'name': u'An Encrypted Volume Type', - 'provider': u'a-provider', - 'control_location': u'front-end', - 'cipher': u'a-cipher', + formData = {'name': 'An Encrypted Volume Type', + 'provider': 'a-provider', + 'control_location': 'front-end', + 'cipher': 'a-cipher', 'key_size': 512, 'volume_type_id': volume_type1.id} @@ -194,9 +194,9 @@ class VolumeTypeTests(test.BaseAdminViewTests): self.mock_volume_type_list.assert_called_once_with( test.IsHttpRequest()) expected = { - 'provider': u'a-provider', - 'control_location': u'front-end', - 'cipher': u'a-cipher', + 'provider': 'a-provider', + 'control_location': 'front-end', + 'cipher': 'a-cipher', 'key_size': 512, } self.mock_volume_encryption_type_create.assert_called_once_with( @@ -208,7 +208,7 @@ class VolumeTypeTests(test.BaseAdminViewTests): 'volume_type_list',)}) def test_type_encryption_detail_view_unencrypted(self): volume_type1 = self.cinder_volume_types.list()[0] - volume_type1.id = u'1' + volume_type1.id = '1' volume_type_list = [volume_type1] vol_unenc_type = self.cinder_volume_encryption_types.list()[2] @@ -235,7 +235,7 @@ class VolumeTypeTests(test.BaseAdminViewTests): 'volume_type_list',)}) def test_type_encryption_detail_view_encrypted(self): volume_type = self.cinder_volume_types.first() - volume_type.id = u'1' + volume_type.id = '1' volume_type.name = "An Encrypted Volume Name" volume_type_list = [volume_type] vol_enc_type = self.cinder_volume_encryption_types.list()[0] @@ -274,7 +274,7 @@ class VolumeTypeTests(test.BaseAdminViewTests): 'volume_encryption_type_delete',)}) def test_delete_volume_type_encryption(self): volume_type = self.cinder_volume_types.first() - volume_type.id = u'1' + volume_type.id = '1' formData = {'action': 'volume_types__delete_encryption__%s' % volume_type.id} encryption_list = (self.cinder_volume_encryption_types.list()[0], @@ -307,12 +307,12 @@ class VolumeTypeTests(test.BaseAdminViewTests): 'volume_type_list')}) def test_update_volume_type_encryption(self): volume_type = self.cinder_volume_types.first() - volume_type.id = u'1' + volume_type.id = '1' volume_type_list = [volume_type] - formData = {'name': u'An Encrypted Volume Type', - 'provider': u'a-provider', - 'control_location': u'front-end', - 'cipher': u'a-cipher', + formData = {'name': 'An Encrypted Volume Type', + 'provider': 'a-provider', + 'control_location': 'front-end', + 'cipher': 'a-cipher', 'key_size': 256, 'volume_type_id': volume_type.id} vol_enc_type = self.cinder_volume_encryption_types.list()[0] @@ -335,9 +335,9 @@ class VolumeTypeTests(test.BaseAdminViewTests): self.mock_volume_type_list.assert_called_once_with( test.IsHttpRequest()) expected = { - 'provider': u'a-provider', - 'control_location': u'front-end', - 'cipher': u'a-cipher', + 'provider': 'a-provider', + 'control_location': 'front-end', + 'cipher': 'a-cipher', 'key_size': 256, } self.mock_volume_encryption_type_update.assert_called_once_with( @@ -352,9 +352,9 @@ class VolumeTypeTests(test.BaseAdminViewTests): api.keystone: ('tenant_list',)}) def _test_edit_volume_type_access(self, exception=False): volume_type = self.cinder_volume_types.list()[2] - volume_type.id = u'1' + volume_type.id = '1' type_access = self.cinder_type_access.list() - formData = {'member': [u'3'], + formData = {'member': ['3'], 'volume_type_id': volume_type.id} self.mock_tenant_list.return_value = [self.tenants.list(), False] @@ -379,9 +379,9 @@ class VolumeTypeTests(test.BaseAdminViewTests): self.mock_volume_type_access_list.assert_called_once_with( test.IsHttpRequest(), volume_type.id) self.mock_volume_type_add_project_access.assert_called_once_with( - test.IsHttpRequest(), volume_type.id, u'3') + test.IsHttpRequest(), volume_type.id, '3') self.mock_volume_type_remove_project_access.assert_called_once_with( - test.IsHttpRequest(), volume_type.id, u'1') + test.IsHttpRequest(), volume_type.id, '1') def test_edit_volume_type_access(self): self._test_edit_volume_type_access() diff --git a/openstack_dashboard/dashboards/admin/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/tests.py index 26af3f32b..b3338ea35 100644 --- a/openstack_dashboard/dashboards/admin/volumes/tests.py +++ b/openstack_dashboard/dashboards/admin/volumes/tests.py @@ -209,11 +209,11 @@ class VolumeTests(test.BaseAdminViewTests): api.cinder: ['extension_supported', 'availability_zone_list', 'volume_type_list', 'volume_manage']}) def test_manage_volume(self): - metadata = {'key': u'k1', - 'value': u'v1'} + metadata = {'key': 'k1', + 'value': 'v1'} form_data = {'host': 'host-1', 'identifier': 'vol-1', - 'id_type': u'source-name', + 'id_type': 'source-name', 'name': 'name-1', 'description': 'manage a volume', 'volume_type': 'vol_type_1', diff --git a/openstack_dashboard/dashboards/identity/domains/tables.py b/openstack_dashboard/dashboards/identity/domains/tables.py index 242481f0c..bd885a695 100644 --- a/openstack_dashboard/dashboards/identity/domains/tables.py +++ b/openstack_dashboard/dashboards/identity/domains/tables.py @@ -92,16 +92,16 @@ class DeleteDomainsAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Domain", - u"Delete Domains", + "Delete Domain", + "Delete Domains", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Domain", - u"Deleted Domains", + "Deleted Domain", + "Deleted Domains", count ) @@ -126,16 +126,16 @@ class DisableDomainsAction(tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Disable Domain", - u"Disable Domains", + "Disable Domain", + "Disable Domains", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Disabled Domain", - u"Disabled Domains", + "Disabled Domain", + "Disabled Domains", count ) @@ -166,16 +166,16 @@ class EnableDomainsAction(tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Enable Domain", - u"Enable Domains", + "Enable Domain", + "Enable Domains", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Enabled Domain", - u"Enabled Domains", + "Enabled Domain", + "Enabled Domains", count ) diff --git a/openstack_dashboard/dashboards/identity/groups/tables.py b/openstack_dashboard/dashboards/identity/groups/tables.py index 5899afeb8..fd171d4b3 100644 --- a/openstack_dashboard/dashboards/identity/groups/tables.py +++ b/openstack_dashboard/dashboards/identity/groups/tables.py @@ -63,16 +63,16 @@ class DeleteGroupsAction(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Group", - u"Delete Groups", + "Delete Group", + "Delete Groups", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Group", - u"Deleted Groups", + "Deleted Group", + "Deleted Groups", count ) @@ -131,16 +131,16 @@ class RemoveMembers(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Remove User", - u"Remove Users", + "Remove User", + "Remove Users", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Removed User", - u"Removed Users", + "Removed User", + "Removed Users", count ) @@ -207,16 +207,16 @@ class AddMembers(tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Add User", - u"Add Users", + "Add User", + "Add Users", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Added User", - u"Added Users", + "Added User", + "Added Users", count ) diff --git a/openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py b/openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py index 15e5d1e3b..9e6a70cbf 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/protocols/tables.py @@ -38,16 +38,16 @@ class RemoveProtocol(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Protocol", - u"Delete Protocols", + "Delete Protocol", + "Delete Protocols", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Protocol", - u"Deleted Protocols", + "Deleted Protocol", + "Deleted Protocols", count ) diff --git a/openstack_dashboard/dashboards/identity/identity_providers/tables.py b/openstack_dashboard/dashboards/identity/identity_providers/tables.py index b25ba8b3c..e0e1f4c3e 100644 --- a/openstack_dashboard/dashboards/identity/identity_providers/tables.py +++ b/openstack_dashboard/dashboards/identity/identity_providers/tables.py @@ -51,16 +51,16 @@ class DeleteIdPsAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Unregister Identity Provider", - u"Unregister Identity Providers", + "Unregister Identity Provider", + "Unregister Identity Providers", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Unregistered Identity Provider", - u"Unregistered Identity Providers", + "Unregistered Identity Provider", + "Unregistered Identity Providers", count ) policy_rules = (("identity", "identity:delete_identity_provider"),) diff --git a/openstack_dashboard/dashboards/identity/mappings/tables.py b/openstack_dashboard/dashboards/identity/mappings/tables.py index 9c22285d6..bc9ce2fb9 100644 --- a/openstack_dashboard/dashboards/identity/mappings/tables.py +++ b/openstack_dashboard/dashboards/identity/mappings/tables.py @@ -44,16 +44,16 @@ class DeleteMappingsAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Mapping", - u"Delete Mappings", + "Delete Mapping", + "Delete Mappings", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Mapping", - u"Deleted Mappings", + "Deleted Mapping", + "Deleted Mappings", count ) policy_rules = (("identity", "identity:delete_mapping"),) diff --git a/openstack_dashboard/dashboards/identity/projects/tables.py b/openstack_dashboard/dashboards/identity/projects/tables.py index 0d10526c5..277ed232e 100644 --- a/openstack_dashboard/dashboards/identity/projects/tables.py +++ b/openstack_dashboard/dashboards/identity/projects/tables.py @@ -160,16 +160,16 @@ class DeleteTenantsAction(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Project", - u"Delete Projects", + "Delete Project", + "Delete Projects", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Project", - u"Deleted Projects", + "Deleted Project", + "Deleted Projects", count ) diff --git a/openstack_dashboard/dashboards/identity/roles/tables.py b/openstack_dashboard/dashboards/identity/roles/tables.py index 6e7c6d354..0eb81d4cd 100644 --- a/openstack_dashboard/dashboards/identity/roles/tables.py +++ b/openstack_dashboard/dashboards/identity/roles/tables.py @@ -48,16 +48,16 @@ class DeleteRolesAction(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Role", - u"Delete Roles", + "Delete Role", + "Delete Roles", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Role", - u"Deleted Roles", + "Deleted Role", + "Deleted Roles", count ) policy_rules = (("identity", "identity:delete_role"),) diff --git a/openstack_dashboard/dashboards/identity/users/tables.py b/openstack_dashboard/dashboards/identity/users/tables.py index d3345c01c..a2b9ba8bd 100644 --- a/openstack_dashboard/dashboards/identity/users/tables.py +++ b/openstack_dashboard/dashboards/identity/users/tables.py @@ -76,13 +76,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction): def action_present(count): return ( ungettext_lazy( - u"Enable User", - u"Enable Users", + "Enable User", + "Enable Users", count ), ungettext_lazy( - u"Disable User", - u"Disable Users", + "Disable User", + "Disable Users", count ), ) @@ -91,13 +91,13 @@ class ToggleEnabled(policy.PolicyTargetMixin, tables.BatchAction): def action_past(count): return ( ungettext_lazy( - u"Enabled User", - u"Enabled Users", + "Enabled User", + "Enabled Users", count ), ungettext_lazy( - u"Disabled User", - u"Disabled Users", + "Disabled User", + "Disabled Users", count ), ) @@ -134,16 +134,16 @@ class DeleteUsersAction(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete User", - u"Delete Users", + "Delete User", + "Delete Users", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted User", - u"Deleted Users", + "Deleted User", + "Deleted Users", count ) policy_rules = (("identity", "identity:delete_user"),) diff --git a/openstack_dashboard/dashboards/identity/users/tests.py b/openstack_dashboard/dashboards/identity/users/tests.py index ebd532a24..232cad62f 100644 --- a/openstack_dashboard/dashboards/identity/users/tests.py +++ b/openstack_dashboard/dashboards/identity/users/tests.py @@ -855,8 +855,8 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USERS_INDEX_URL, formData, follow=True) self.assertEqual(list(res.context['messages'])[0].message, - u'You are not allowed to disable user: ' - u'test_user') + 'You are not allowed to disable user: ' + 'test_user') self.assert_mock_multiple_calls_with_same_arguments( self.mock_get_effective_domain_id, 2, @@ -889,8 +889,8 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USERS_INDEX_URL, formData, follow=True) self.assertEqual(list(res.context['messages'])[0].message, - u'You are not allowed to disable user: ' - u'test_user') + 'You are not allowed to disable user: ' + 'test_user') self.assert_mock_multiple_calls_with_same_arguments( self.mock_get_effective_domain_id, 2, @@ -919,7 +919,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USERS_INDEX_URL, formData, follow=True) self.assertEqual(list(res.context['messages'])[0].message, - u'You are not allowed to delete user: %s' + 'You are not allowed to delete user: %s' % self.request.user.username) self.assert_mock_multiple_calls_with_same_arguments( @@ -953,7 +953,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USERS_INDEX_URL, formData, follow=True) self.assertEqual(list(res.context['messages'])[0].message, - u'You are not allowed to delete user: %s' + 'You are not allowed to delete user: %s' % self.request.user.username) self.assert_mock_multiple_calls_with_same_arguments( diff --git a/openstack_dashboard/dashboards/project/api_access/tests.py b/openstack_dashboard/dashboards/project/api_access/tests.py index 865d63f0c..66d570999 100644 --- a/openstack_dashboard/dashboards/project/api_access/tests.py +++ b/openstack_dashboard/dashboards/project/api_access/tests.py @@ -132,7 +132,7 @@ class ASCIITenantNameRCTests(test.TestCase): class UnicodeTenantNameRCTests(test.TestCase): - TENANT_NAME = u'\u043f\u0440\u043e\u0435\u043a\u0442' + TENANT_NAME = '\u043f\u0440\u043e\u0435\u043a\u0442' def _setup_user(self, **kwargs): super()._setup_user(tenant_name=self.TENANT_NAME) diff --git a/openstack_dashboard/dashboards/project/backups/tables.py b/openstack_dashboard/dashboards/project/backups/tables.py index 4b7e32e69..e631a5ccb 100644 --- a/openstack_dashboard/dashboards/project/backups/tables.py +++ b/openstack_dashboard/dashboards/project/backups/tables.py @@ -69,16 +69,16 @@ class DeleteBackup(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Volume Backup", - u"Delete Volume Backups", + "Delete Volume Backup", + "Delete Volume Backups", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled deletion of Volume Backup", - u"Scheduled deletion of Volume Backups", + "Scheduled deletion of Volume Backup", + "Scheduled deletion of Volume Backups", count ) @@ -145,17 +145,17 @@ class BackupsTable(tables.DataTable): ) STATUS_DISPLAY_CHOICES = ( ("available", pgettext_lazy("Current status of a Volume Backup", - u"Available")), + "Available")), ("error", pgettext_lazy("Current status of a Volume Backup", - u"Error")), + "Error")), ("creating", pgettext_lazy("Current status of a Volume Backup", - u"Creating")), + "Creating")), ("restoring", pgettext_lazy("Current status of a Volume Backup", - u"Restoring")), + "Restoring")), ("deleting", pgettext_lazy("Current status of a Volume Backup", - u"Deleting")), + "Deleting")), ("error_restoring", pgettext_lazy("Current status of a Volume Backup", - u"Error Restoring")), + "Error Restoring")), ) name = tables.Column("name", verbose_name=_("Name"), diff --git a/openstack_dashboard/dashboards/project/floating_ips/tables.py b/openstack_dashboard/dashboards/project/floating_ips/tables.py index 765da4dc4..f28d2792e 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/tables.py +++ b/openstack_dashboard/dashboards/project/floating_ips/tables.py @@ -75,16 +75,16 @@ class ReleaseIPs(tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Release Floating IP", - u"Release Floating IPs", + "Release Floating IP", + "Release Floating IPs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Released Floating IP", - u"Released Floating IPs", + "Released Floating IP", + "Released Floating IPs", count ) @@ -158,9 +158,9 @@ def get_instance_link(datum): STATUS_DISPLAY_CHOICES = ( - ("active", pgettext_lazy("Current status of a Floating IP", u"Active")), - ("down", pgettext_lazy("Current status of a Floating IP", u"Down")), - ("error", pgettext_lazy("Current status of a Floating IP", u"Error")), + ("active", pgettext_lazy("Current status of a Floating IP", "Active")), + ("down", pgettext_lazy("Current status of a Floating IP", "Down")), + ("error", pgettext_lazy("Current status of a Floating IP", "Error")), ) diff --git a/openstack_dashboard/dashboards/project/images/images/tables.py b/openstack_dashboard/dashboards/project/images/images/tables.py index abac0d098..21bea9a19 100644 --- a/openstack_dashboard/dashboards/project/images/images/tables.py +++ b/openstack_dashboard/dashboards/project/images/images/tables.py @@ -90,16 +90,16 @@ class DeleteImage(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Image", - u"Delete Images", + "Delete Image", + "Delete Images", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Image", - u"Deleted Images", + "Deleted Image", + "Deleted Images", count ) @@ -266,10 +266,10 @@ def get_format(image): if format == "raw": if getattr(image, "container_format") == 'docker': return pgettext_lazy("Image format for display in table", - u"Docker") + "Docker") # Most image formats are untranslated acronyms, but raw is a word # and should be translated - return pgettext_lazy("Image format for display in table", u"Raw") + return pgettext_lazy("Image format for display in table", "Raw") return format.upper() @@ -301,19 +301,19 @@ class ImagesTable(tables.DataTable): ("deactivated", False), ) STATUS_DISPLAY_CHOICES = ( - ("active", pgettext_lazy("Current status of an Image", u"Active")), - ("saving", pgettext_lazy("Current status of an Image", u"Saving")), - ("queued", pgettext_lazy("Current status of an Image", u"Queued")), + ("active", pgettext_lazy("Current status of an Image", "Active")), + ("saving", pgettext_lazy("Current status of an Image", "Saving")), + ("queued", pgettext_lazy("Current status of an Image", "Queued")), ("pending_delete", pgettext_lazy("Current status of an Image", - u"Pending Delete")), - ("killed", pgettext_lazy("Current status of an Image", u"Killed")), - ("deleted", pgettext_lazy("Current status of an Image", u"Deleted")), + "Pending Delete")), + ("killed", pgettext_lazy("Current status of an Image", "Killed")), + ("deleted", pgettext_lazy("Current status of an Image", "Deleted")), ("deactivated", pgettext_lazy("Current status of an Image", - u"Deactivated")), + "Deactivated")), ) TYPE_CHOICES = ( - ("image", pgettext_lazy("Type of an image", u"Image")), - ("snapshot", pgettext_lazy("Type of an image", u"Snapshot")), + ("image", pgettext_lazy("Type of an image", "Image")), + ("snapshot", pgettext_lazy("Type of an image", "Snapshot")), ) name = tables.WrappingColumn(get_image_name, link="horizon:project:images:images:detail", diff --git a/openstack_dashboard/dashboards/project/images/images/tests.py b/openstack_dashboard/dashboards/project/images/images/tests.py index e383d2390..1a5dca8fa 100644 --- a/openstack_dashboard/dashboards/project/images/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/images/tests.py @@ -50,11 +50,11 @@ class CreateImageFormTests(test.ResetImageAPIVersionMixin, test.TestCase): ] post = { - 'name': u'Ubuntu 11.10', - 'source_type': u'file', - 'description': u'Login with admin/admin', - 'disk_format': u'qcow2', - 'architecture': u'x86-64', + 'name': 'Ubuntu 11.10', + 'source_type': 'file', + 'description': 'Login with admin/admin', + 'disk_format': 'qcow2', + 'architecture': 'x86-64', 'min_disk': 15, 'min_ram': 512, 'is_public': 1} @@ -91,15 +91,15 @@ class UpdateImageFormTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_image_update_post_v2(self, mock_image_update, mock_image_get): image = self.images.first() data = { - 'name': u'Ubuntu 11.10', + 'name': 'Ubuntu 11.10', 'image_id': str(image.id), - 'description': u'Login with admin/admin', - 'source_type': u'url', - 'image_url': u'http://cloud-images.ubuntu.com/releases/' - u'oneiric/release/ubuntu-11.10-server-cloudimg' - u'-amd64-disk1.img', - 'disk_format': u'qcow2', - 'architecture': u'x86-64', + 'description': 'Login with admin/admin', + 'source_type': 'url', + 'image_url': 'http://cloud-images.ubuntu.com/releases/' + 'oneiric/release/ubuntu-11.10-server-cloudimg' + '-amd64-disk1.img', + 'disk_format': 'qcow2', + 'architecture': 'x86-64', 'min_disk': 15, 'min_ram': 512, 'is_public': False, @@ -155,10 +155,10 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_image_create_post_location_v2(self, mock_schemas_list): mock_schemas_list.return_value = self.image_schemas.first() data = { - 'source_type': u'url', - 'image_url': u'http://cloud-images.ubuntu.com/releases/' - u'oneiric/release/ubuntu-11.10-server-cloudimg' - u'-amd64-disk1.img'} + 'source_type': 'url', + 'image_url': 'http://cloud-images.ubuntu.com/releases/' + 'oneiric/release/ubuntu-11.10-server-cloudimg' + '-amd64-disk1.img'} api_data = {'location': data['image_url']} self._test_image_create(data, api_data) @@ -171,7 +171,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase): temp_file.flush() temp_file.seek(0) - data = {'source_type': u'file', + data = {'source_type': 'file', 'image_file': temp_file} api_data = {'data': test.IsA(InMemoryUploadedFile)} @@ -186,7 +186,7 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase): temp_file.seek(0) data = { - 'source_type': u'file', + 'source_type': 'file', 'image_file': temp_file, 'kernel_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482e', 'ramdisk_id': '007e7d55-fe1e-4c5c-bf08-44b4a496482a' @@ -200,10 +200,10 @@ class ImageViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def _test_image_create(self, extra_form_data, extra_api_data, mock_image_list, mock_image_create): data = { - 'name': u'Ubuntu 11.10', - 'description': u'Login with admin/admin', - 'disk_format': u'qcow2', - 'architecture': u'x86-64', + 'name': 'Ubuntu 11.10', + 'description': 'Login with admin/admin', + 'disk_format': 'qcow2', + 'architecture': 'x86-64', 'min_disk': 15, 'min_ram': 512, 'is_public': True, diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index 52ae38ee9..0de38198e 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -115,23 +115,23 @@ class ImagesAndSnapshotsTests(BaseImagesTestCase): # first instance - status active, owned self.assertEqual(len(row_actions), 5) - self.assertEqual(row_actions[0].verbose_name, u"Launch") - self.assertEqual(row_actions[1].verbose_name, u"Create Volume") - self.assertEqual(row_actions[2].verbose_name, u"Edit Image") - self.assertEqual(row_actions[3].verbose_name, u"Update Metadata") - self.assertEqual(row_actions[4].verbose_name, u"Delete Image") + self.assertEqual(row_actions[0].verbose_name, "Launch") + self.assertEqual(row_actions[1].verbose_name, "Create Volume") + self.assertEqual(row_actions[2].verbose_name, "Edit Image") + self.assertEqual(row_actions[3].verbose_name, "Update Metadata") + self.assertEqual(row_actions[4].verbose_name, "Delete Image") row_actions = snaps.get_row_actions(snaps.data[1]) # second instance - status active, not owned self.assertEqual(len(row_actions), 2) - self.assertEqual(row_actions[0].verbose_name, u"Launch") - self.assertEqual(row_actions[1].verbose_name, u"Create Volume") + self.assertEqual(row_actions[0].verbose_name, "Launch") + self.assertEqual(row_actions[1].verbose_name, "Create Volume") row_actions = snaps.get_row_actions(snaps.data[2]) # third instance - status queued, only delete is available self.assertEqual(len(row_actions), 1) - self.assertEqual(row_actions[0].verbose_name, u"Delete Image") + self.assertEqual(row_actions[0].verbose_name, "Delete Image") self.assertEqual(str(row_actions[0]), "<DeleteImage: delete>") self.mock_image_list.assert_called_once_with(test.IsHttpRequest(), diff --git a/openstack_dashboard/dashboards/project/instances/audit_tables.py b/openstack_dashboard/dashboards/project/instances/audit_tables.py index 74a59ce14..9d7b99210 100644 --- a/openstack_dashboard/dashboards/project/instances/audit_tables.py +++ b/openstack_dashboard/dashboards/project/instances/audit_tables.py @@ -22,27 +22,27 @@ from horizon.utils import filters class AuditTable(tables.DataTable): ACTION_DISPLAY_CHOICES = ( - ("create", pgettext_lazy("Action log of an instance", u"Create")), - ("pause", pgettext_lazy("Action log of an instance", u"Pause")), - ("unpause", pgettext_lazy("Action log of an instance", u"Unpause")), - ("rebuild", pgettext_lazy("Action log of an instance", u"Rebuild")), - ("resize", pgettext_lazy("Action log of an instance", u"Resize")), + ("create", pgettext_lazy("Action log of an instance", "Create")), + ("pause", pgettext_lazy("Action log of an instance", "Pause")), + ("unpause", pgettext_lazy("Action log of an instance", "Unpause")), + ("rebuild", pgettext_lazy("Action log of an instance", "Rebuild")), + ("resize", pgettext_lazy("Action log of an instance", "Resize")), ("confirmresize", pgettext_lazy("Action log of an instance", - u"Confirm Resize")), - ("suspend", pgettext_lazy("Action log of an instance", u"Suspend")), - ("resume", pgettext_lazy("Action log of an instance", u"Resume")), - ("reboot", pgettext_lazy("Action log of an instance", u"Reboot")), - ("stop", pgettext_lazy("Action log of an instance", u"Stop")), - ("start", pgettext_lazy("Action log of an instance", u"Start")), - ("shelve", pgettext_lazy("Action log of an instance", u"Shelve")), - ("unshelve", pgettext_lazy("Action log of an instance", u"Unshelve")), - ("migrate", pgettext_lazy("Action log of an instance", u"Migrate")), - ("rescue", pgettext_lazy("Action log of an instance", u"Rescue")), - ("unrescue", pgettext_lazy("Action log of an instance", u"Unrescue")), - ("lock", pgettext_lazy("Action log of an instance", u"Lock")), - ("unlock", pgettext_lazy("Action log of an instance", u"Unlock")), + "Confirm Resize")), + ("suspend", pgettext_lazy("Action log of an instance", "Suspend")), + ("resume", pgettext_lazy("Action log of an instance", "Resume")), + ("reboot", pgettext_lazy("Action log of an instance", "Reboot")), + ("stop", pgettext_lazy("Action log of an instance", "Stop")), + ("start", pgettext_lazy("Action log of an instance", "Start")), + ("shelve", pgettext_lazy("Action log of an instance", "Shelve")), + ("unshelve", pgettext_lazy("Action log of an instance", "Unshelve")), + ("migrate", pgettext_lazy("Action log of an instance", "Migrate")), + ("rescue", pgettext_lazy("Action log of an instance", "Rescue")), + ("unrescue", pgettext_lazy("Action log of an instance", "Unrescue")), + ("lock", pgettext_lazy("Action log of an instance", "Lock")), + ("unlock", pgettext_lazy("Action log of an instance", "Unlock")), ("createimage", pgettext_lazy("Action log of an instance", - u"Create Image")), + "Create Image")), ) request_id = tables.Column('request_id', diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index 40b33589b..674ebdca2 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -89,16 +89,16 @@ class DeleteInstance(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Instance", - u"Delete Instances", + "Delete Instance", + "Delete Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled deletion of Instance", - u"Scheduled deletion of Instances", + "Scheduled deletion of Instance", + "Scheduled deletion of Instances", count ) @@ -123,16 +123,16 @@ class RebootInstance(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Hard Reboot Instance", - u"Hard Reboot Instances", + "Hard Reboot Instance", + "Hard Reboot Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Hard Rebooted Instance", - u"Hard Rebooted Instances", + "Hard Rebooted Instance", + "Hard Rebooted Instances", count ) @@ -153,16 +153,16 @@ class SoftRebootInstance(RebootInstance): @staticmethod def action_present(count): return ungettext_lazy( - u"Soft Reboot Instance", - u"Soft Reboot Instances", + "Soft Reboot Instance", + "Soft Reboot Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Soft Rebooted Instance", - u"Soft Rebooted Instances", + "Soft Rebooted Instance", + "Soft Rebooted Instances", count ) @@ -197,16 +197,16 @@ class UnRescueInstance(tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Unrescue Instance", - u"Unrescue Instances", + "Unrescue Instance", + "Unrescue Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Unrescued Instance", - u"Unrescued Instances", + "Unrescued Instance", + "Unrescued Instances", count ) @@ -227,13 +227,13 @@ class TogglePause(tables.BatchAction): def action_present(count): return ( ungettext_lazy( - u"Pause Instance", - u"Pause Instances", + "Pause Instance", + "Pause Instances", count ), ungettext_lazy( - u"Resume Instance", - u"Resume Instances", + "Resume Instance", + "Resume Instances", count ), ) @@ -242,13 +242,13 @@ class TogglePause(tables.BatchAction): def action_past(count): return ( ungettext_lazy( - u"Paused Instance", - u"Paused Instances", + "Paused Instance", + "Paused Instances", count ), ungettext_lazy( - u"Resumed Instance", - u"Resumed Instances", + "Resumed Instance", + "Resumed Instances", count ), ) @@ -291,13 +291,13 @@ class ToggleSuspend(tables.BatchAction): def action_present(count): return ( ungettext_lazy( - u"Suspend Instance", - u"Suspend Instances", + "Suspend Instance", + "Suspend Instances", count ), ungettext_lazy( - u"Resume Instance", - u"Resume Instances", + "Resume Instance", + "Resume Instances", count ), ) @@ -306,13 +306,13 @@ class ToggleSuspend(tables.BatchAction): def action_past(count): return ( ungettext_lazy( - u"Suspended Instance", - u"Suspended Instances", + "Suspended Instance", + "Suspended Instances", count ), ungettext_lazy( - u"Resumed Instance", - u"Resumed Instances", + "Resumed Instance", + "Resumed Instances", count ), ) @@ -355,13 +355,13 @@ class ToggleShelve(tables.BatchAction): def action_present(count): return ( ungettext_lazy( - u"Shelve Instance", - u"Shelve Instances", + "Shelve Instance", + "Shelve Instances", count ), ungettext_lazy( - u"Unshelve Instance", - u"Unshelve Instances", + "Unshelve Instance", + "Unshelve Instances", count ), ) @@ -370,13 +370,13 @@ class ToggleShelve(tables.BatchAction): def action_past(count): return ( ungettext_lazy( - u"Shelved Instance", - u"Shelved Instances", + "Shelved Instance", + "Shelved Instances", count ), ungettext_lazy( - u"Unshelved Instance", - u"Unshelved Instances", + "Unshelved Instance", + "Unshelved Instances", count ), ) @@ -817,16 +817,16 @@ class StartInstance(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Start Instance", - u"Start Instances", + "Start Instance", + "Start Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Started Instance", - u"Started Instances", + "Started Instance", + "Started Instances", count ) @@ -848,8 +848,8 @@ class StopInstance(policy.PolicyTargetMixin, tables.BatchAction): def action_present(count): return npgettext_lazy( "Action to perform (the instance is currently running)", - u"Shut Off Instance", - u"Shut Off Instances", + "Shut Off Instance", + "Shut Off Instances", count ) @@ -857,8 +857,8 @@ class StopInstance(policy.PolicyTargetMixin, tables.BatchAction): def action_past(count): return npgettext_lazy( "Past action (the instance is currently already Shut Off)", - u"Shut Off Instance", - u"Shut Off Instances", + "Shut Off Instance", + "Shut Off Instances", count ) @@ -878,16 +878,16 @@ class LockInstance(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Lock Instance", - u"Lock Instances", + "Lock Instance", + "Lock Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Locked Instance", - u"Locked Instances", + "Locked Instance", + "Locked Instances", count ) @@ -910,16 +910,16 @@ class UnlockInstance(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Unlock Instance", - u"Unlock Instances", + "Unlock Instance", + "Unlock Instances", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Unlocked Instance", - u"Unlocked Instances", + "Unlocked Instance", + "Unlocked Instances", count ) @@ -1059,131 +1059,131 @@ def get_power_state(instance): STATUS_DISPLAY_CHOICES = ( - ("deleted", pgettext_lazy("Current status of an Instance", u"Deleted")), - ("active", pgettext_lazy("Current status of an Instance", u"Active")), - ("shutoff", pgettext_lazy("Current status of an Instance", u"Shutoff")), + ("deleted", pgettext_lazy("Current status of an Instance", "Deleted")), + ("active", pgettext_lazy("Current status of an Instance", "Active")), + ("shutoff", pgettext_lazy("Current status of an Instance", "Shutoff")), ("suspended", pgettext_lazy("Current status of an Instance", - u"Suspended")), - ("paused", pgettext_lazy("Current status of an Instance", u"Paused")), - ("error", pgettext_lazy("Current status of an Instance", u"Error")), + "Suspended")), + ("paused", pgettext_lazy("Current status of an Instance", "Paused")), + ("error", pgettext_lazy("Current status of an Instance", "Error")), ("resize", pgettext_lazy("Current status of an Instance", - u"Resize/Migrate")), + "Resize/Migrate")), ("verify_resize", pgettext_lazy("Current status of an Instance", - u"Confirm or Revert Resize/Migrate")), + "Confirm or Revert Resize/Migrate")), ("revert_resize", pgettext_lazy( - "Current status of an Instance", u"Revert Resize/Migrate")), - ("reboot", pgettext_lazy("Current status of an Instance", u"Reboot")), + "Current status of an Instance", "Revert Resize/Migrate")), + ("reboot", pgettext_lazy("Current status of an Instance", "Reboot")), ("hard_reboot", pgettext_lazy("Current status of an Instance", - u"Hard Reboot")), - ("password", pgettext_lazy("Current status of an Instance", u"Password")), - ("rebuild", pgettext_lazy("Current status of an Instance", u"Rebuild")), + "Hard Reboot")), + ("password", pgettext_lazy("Current status of an Instance", "Password")), + ("rebuild", pgettext_lazy("Current status of an Instance", "Rebuild")), ("migrating", pgettext_lazy("Current status of an Instance", - u"Migrating")), - ("build", pgettext_lazy("Current status of an Instance", u"Build")), - ("rescue", pgettext_lazy("Current status of an Instance", u"Rescue")), + "Migrating")), + ("build", pgettext_lazy("Current status of an Instance", "Build")), + ("rescue", pgettext_lazy("Current status of an Instance", "Rescue")), ("soft-delete", pgettext_lazy("Current status of an Instance", - u"Soft Deleted")), - ("shelved", pgettext_lazy("Current status of an Instance", u"Shelved")), + "Soft Deleted")), + ("shelved", pgettext_lazy("Current status of an Instance", "Shelved")), ("shelved_offloaded", pgettext_lazy("Current status of an Instance", - u"Shelved Offloaded")), + "Shelved Offloaded")), # these vm states are used when generating CSV usage summary - ("building", pgettext_lazy("Current status of an Instance", u"Building")), - ("stopped", pgettext_lazy("Current status of an Instance", u"Stopped")), - ("rescued", pgettext_lazy("Current status of an Instance", u"Rescued")), - ("resized", pgettext_lazy("Current status of an Instance", u"Resized")), + ("building", pgettext_lazy("Current status of an Instance", "Building")), + ("stopped", pgettext_lazy("Current status of an Instance", "Stopped")), + ("rescued", pgettext_lazy("Current status of an Instance", "Rescued")), + ("resized", pgettext_lazy("Current status of an Instance", "Resized")), ) -TASK_DISPLAY_NONE = pgettext_lazy("Task status of an Instance", u"None") +TASK_DISPLAY_NONE = pgettext_lazy("Task status of an Instance", "None") # Mapping of task states taken from Nova's nova/compute/task_states.py TASK_DISPLAY_CHOICES = ( ("scheduling", pgettext_lazy("Task status of an Instance", - u"Scheduling")), + "Scheduling")), ("block_device_mapping", pgettext_lazy("Task status of an Instance", - u"Block Device Mapping")), + "Block Device Mapping")), ("networking", pgettext_lazy("Task status of an Instance", - u"Networking")), - ("spawning", pgettext_lazy("Task status of an Instance", u"Spawning")), + "Networking")), + ("spawning", pgettext_lazy("Task status of an Instance", "Spawning")), ("image_snapshot", pgettext_lazy("Task status of an Instance", - u"Snapshotting")), + "Snapshotting")), ("image_snapshot_pending", pgettext_lazy("Task status of an Instance", - u"Image Snapshot Pending")), + "Image Snapshot Pending")), ("image_pending_upload", pgettext_lazy("Task status of an Instance", - u"Image Pending Upload")), + "Image Pending Upload")), ("image_uploading", pgettext_lazy("Task status of an Instance", - u"Image Uploading")), + "Image Uploading")), ("image_backup", pgettext_lazy("Task status of an Instance", - u"Image Backup")), + "Image Backup")), ("updating_password", pgettext_lazy("Task status of an Instance", - u"Updating Password")), + "Updating Password")), ("resize_prep", pgettext_lazy("Task status of an Instance", - u"Preparing Resize or Migrate")), + "Preparing Resize or Migrate")), ("resize_migrating", pgettext_lazy("Task status of an Instance", - u"Resizing or Migrating")), + "Resizing or Migrating")), ("resize_migrated", pgettext_lazy("Task status of an Instance", - u"Resized or Migrated")), + "Resized or Migrated")), ("resize_finish", pgettext_lazy("Task status of an Instance", - u"Finishing Resize or Migrate")), + "Finishing Resize or Migrate")), ("resize_reverting", pgettext_lazy("Task status of an Instance", - u"Reverting Resize or Migrate")), + "Reverting Resize or Migrate")), ("resize_confirming", pgettext_lazy("Task status of an Instance", - u"Confirming Resize or Migrate")), - ("rebooting", pgettext_lazy("Task status of an Instance", u"Rebooting")), + "Confirming Resize or Migrate")), + ("rebooting", pgettext_lazy("Task status of an Instance", "Rebooting")), ("reboot_pending", pgettext_lazy("Task status of an Instance", - u"Reboot Pending")), + "Reboot Pending")), ("reboot_started", pgettext_lazy("Task status of an Instance", - u"Reboot Started")), + "Reboot Started")), ("rebooting_hard", pgettext_lazy("Task status of an Instance", - u"Hard Rebooting")), + "Hard Rebooting")), ("reboot_pending_hard", pgettext_lazy("Task status of an Instance", - u"Hard Reboot Pending")), + "Hard Reboot Pending")), ("reboot_started_hard", pgettext_lazy("Task status of an Instance", - u"Hard Reboot Started")), - ("pausing", pgettext_lazy("Task status of an Instance", u"Pausing")), - ("unpausing", pgettext_lazy("Task status of an Instance", u"Resuming")), + "Hard Reboot Started")), + ("pausing", pgettext_lazy("Task status of an Instance", "Pausing")), + ("unpausing", pgettext_lazy("Task status of an Instance", "Resuming")), ("suspending", pgettext_lazy("Task status of an Instance", - u"Suspending")), - ("resuming", pgettext_lazy("Task status of an Instance", u"Resuming")), + "Suspending")), + ("resuming", pgettext_lazy("Task status of an Instance", "Resuming")), ("powering-off", pgettext_lazy("Task status of an Instance", - u"Powering Off")), + "Powering Off")), ("powering-on", pgettext_lazy("Task status of an Instance", - u"Powering On")), - ("rescuing", pgettext_lazy("Task status of an Instance", u"Rescuing")), + "Powering On")), + ("rescuing", pgettext_lazy("Task status of an Instance", "Rescuing")), ("unrescuing", pgettext_lazy("Task status of an Instance", - u"Unrescuing")), + "Unrescuing")), ("rebuilding", pgettext_lazy("Task status of an Instance", - u"Rebuilding")), + "Rebuilding")), ("rebuild_block_device_mapping", pgettext_lazy( - "Task status of an Instance", u"Rebuild Block Device Mapping")), + "Task status of an Instance", "Rebuild Block Device Mapping")), ("rebuild_spawning", pgettext_lazy("Task status of an Instance", - u"Rebuild Spawning")), - ("migrating", pgettext_lazy("Task status of an Instance", u"Migrating")), - ("deleting", pgettext_lazy("Task status of an Instance", u"Deleting")), + "Rebuild Spawning")), + ("migrating", pgettext_lazy("Task status of an Instance", "Migrating")), + ("deleting", pgettext_lazy("Task status of an Instance", "Deleting")), ("soft-deleting", pgettext_lazy("Task status of an Instance", - u"Soft Deleting")), - ("restoring", pgettext_lazy("Task status of an Instance", u"Restoring")), - ("shelving", pgettext_lazy("Task status of an Instance", u"Shelving")), + "Soft Deleting")), + ("restoring", pgettext_lazy("Task status of an Instance", "Restoring")), + ("shelving", pgettext_lazy("Task status of an Instance", "Shelving")), ("shelving_image_pending_upload", pgettext_lazy( - "Task status of an Instance", u"Shelving Image Pending Upload")), + "Task status of an Instance", "Shelving Image Pending Upload")), ("shelving_image_uploading", pgettext_lazy("Task status of an Instance", - u"Shelving Image Uploading")), + "Shelving Image Uploading")), ("shelving_offloading", pgettext_lazy("Task status of an Instance", - u"Shelving Offloading")), + "Shelving Offloading")), ("unshelving", pgettext_lazy("Task status of an Instance", - u"Unshelving")), + "Unshelving")), ) POWER_DISPLAY_CHOICES = ( - ("NO STATE", pgettext_lazy("Power state of an Instance", u"No State")), - ("RUNNING", pgettext_lazy("Power state of an Instance", u"Running")), - ("BLOCKED", pgettext_lazy("Power state of an Instance", u"Blocked")), - ("PAUSED", pgettext_lazy("Power state of an Instance", u"Paused")), - ("SHUTDOWN", pgettext_lazy("Power state of an Instance", u"Shut Down")), - ("SHUTOFF", pgettext_lazy("Power state of an Instance", u"Shut Off")), - ("CRASHED", pgettext_lazy("Power state of an Instance", u"Crashed")), - ("SUSPENDED", pgettext_lazy("Power state of an Instance", u"Suspended")), - ("FAILED", pgettext_lazy("Power state of an Instance", u"Failed")), - ("BUILDING", pgettext_lazy("Power state of an Instance", u"Building")), + ("NO STATE", pgettext_lazy("Power state of an Instance", "No State")), + ("RUNNING", pgettext_lazy("Power state of an Instance", "Running")), + ("BLOCKED", pgettext_lazy("Power state of an Instance", "Blocked")), + ("PAUSED", pgettext_lazy("Power state of an Instance", "Paused")), + ("SHUTDOWN", pgettext_lazy("Power state of an Instance", "Shut Down")), + ("SHUTOFF", pgettext_lazy("Power state of an Instance", "Shut Off")), + ("CRASHED", pgettext_lazy("Power state of an Instance", "Crashed")), + ("SUSPENDED", pgettext_lazy("Power state of an Instance", "Suspended")), + ("FAILED", pgettext_lazy("Power state of an Instance", "Failed")), + ("BUILDING", pgettext_lazy("Power state of an Instance", "Building")), ) INSTANCE_FILTER_CHOICES = ( diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index dc5da6753..6ad04a529 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -2523,8 +2523,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase, nics=nics, availability_zone=avail_zone.zoneName, instance_count=helpers.IsA(int), - admin_pass=u'', - disk_config=u'AUTO', + admin_pass='', + disk_config='AUTO', config_drive=True, scheduler_hints=scheduler_hints) self.mock_tenant_quota_usages.assert_called_once_with( @@ -2556,13 +2556,13 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' volume_choice = "%s:vol" % volume.id volume_source_id = volume.id.split(':')[0] block_device_mapping = None block_device_mapping_2 = [ - {'device_name': u'vda', + {'device_name': 'vda', 'source_type': 'volume', 'destination_type': 'volume', 'delete_on_termination': False, @@ -2634,8 +2634,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase, nics=nics, availability_zone=avail_zone.zoneName, instance_count=helpers.IsA(int), - admin_pass=u'', - disk_config=u'AUTO', + admin_pass='', + disk_config='AUTO', config_drive=True, scheduler_hints={}) self.mock_tenant_quota_usages.assert_called_once_with( @@ -2667,7 +2667,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' volume_choice = "%s:vol" % volume.id block_device_mapping = [ {'device_name': device_name, @@ -2749,7 +2749,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, nics=nics, availability_zone=avail_zone.zoneName, instance_count=helpers.IsA(int), - admin_pass=u'', + admin_pass='', disk_config='MANUAL', config_drive=True, scheduler_hints={}) @@ -2856,13 +2856,13 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' snapshot_choice = "%s:snap" % snapshot.id snapshot_source_id = snapshot.id.split(':')[0] block_device_mapping = None block_device_mapping_2 = [ - {'device_name': u'vda', + {'device_name': 'vda', 'source_type': 'snapshot', 'destination_type': 'volume', 'delete_on_termination': 0, @@ -2936,8 +2936,8 @@ class InstanceLaunchInstanceTests(InstanceTestBase, nics=nics, availability_zone=avail_zone.zoneName, instance_count=helpers.IsA(int), - admin_pass=u'', - disk_config=u'AUTO', + admin_pass='', + disk_config='AUTO', config_drive=True, scheduler_hints={}) self.mock_tenant_quota_usages.assert_called_once_with( @@ -3208,7 +3208,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' volume_choice = "%s:vol" % volume.id quota_usages = self.quota_usages.first() @@ -3287,7 +3287,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' volume_choice = "%s:vol" % volume.id quota_usages = self.quota_usages.first() if resource == 'both': @@ -3386,7 +3386,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' volume_choice = "%s:vol" % volume.id quota_usages = self.quota_usages.first() @@ -3630,7 +3630,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': True},) def test_launch_form_instance_device_name_showed(self): self._test_launch_form_instance_show_device_name( - u'vda', widgets.TextInput, { + 'vda', widgets.TextInput, { 'name': 'device_name', 'value': 'vda', 'attrs': {'id': 'id_device_name'}} ) @@ -3639,7 +3639,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, OPENSTACK_HYPERVISOR_FEATURES={'can_set_mount_point': False}) def test_launch_form_instance_device_name_hidden(self): self._test_launch_form_instance_show_device_name( - u'', widgets.HiddenInput, { + '', widgets.HiddenInput, { 'name': 'device_name', 'value': '', 'attrs': {'id': 'id_device_name'}} ) @@ -3664,7 +3664,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, sec_group = self.security_groups.first() avail_zone = self.availability_zones.first() customization_script = 'user data' - device_name = u'vda' + device_name = 'vda' quota_usages = self.quota_usages.first() quota_usages['cores']['available'] = 2000 if avail_volumes is not None: @@ -3906,7 +3906,7 @@ class InstanceLaunchInstanceTests(InstanceTestBase, avail_zone = self.availability_zones.first() customization_script = 'user data' nics = [{'net-id': self.networks.first().id, 'v4-fixed-ip': ''}] - device_name = u'' + device_name = '' quota_usages = self.quota_usages.first() quota_usages['cores']['available'] = 2000 device_mapping_v2 = [{'device_name': None, # device_name must be None @@ -3980,9 +3980,9 @@ class InstanceLaunchInstanceTests(InstanceTestBase, nics=nics, availability_zone=avail_zone.zoneName, instance_count=helpers.IsA(int), - admin_pass=u'', + admin_pass='', config_drive=False, - disk_config=u'', + disk_config='', scheduler_hints={}) @@ -4261,7 +4261,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): self.mock_server_group_list.return_value = self.server_groups.list() self.mock_server_resize.return_value = [] - res = self._instance_resize_post(server.id, flavor.id, u'AUTO') + res = self._instance_resize_post(server.id, flavor.id, 'AUTO') self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) @@ -4352,7 +4352,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): def test_rebuild_instance_post_with_password(self): server = self.servers.first() image = self.images.first() - password = u'testpass' + password = 'testpass' self.mock_server_get.return_value = server self._mock_glance_image_list_detailed(self.images.list()) @@ -4406,8 +4406,8 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): def test_rebuild_instance_post_password_do_not_match(self): server = self.servers.first() image = self.images.first() - pass1 = u'somepass' - pass2 = u'notsomepass' + pass1 = 'somepass' + pass2 = 'notsomepass' self.mock_server_get.return_value = server self._mock_glance_image_list_detailed(self.images.list()) @@ -4439,9 +4439,9 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): self.mock_is_feature_available.return_value = False res = self._instance_rebuild_post(server.id, image.id, - password=u'', - confirm_password=u'', - disk_config=u'AUTO') + password='', + confirm_password='', + disk_config='AUTO') self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) @@ -4489,7 +4489,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): def test_rebuild_instance_post_api_exception(self): server = self.servers.first() image = self.images.first() - password = u'testpass' + password = 'testpass' self.mock_server_get.return_value = server self._mock_glance_image_list_detailed(self.images.list()) @@ -4711,7 +4711,7 @@ class InstanceTests2(InstanceTestBase, InstanceTableTestMixin): def test_rescue_instance_post(self): server = self.servers.first() image = self.images.first() - password = u'testpass' + password = 'testpass' self._mock_glance_image_list_detailed(self.images.list()) self.mock_server_rescue.return_value = [] res = self._server_rescue_post(server.id, image.id, @@ -4839,10 +4839,10 @@ class InstanceAjaxTests(helpers.TestCase): messages = json.loads(res['X-Horizon-Messages']) self.assertEqual(len(messages), 1) # (Pdb) messages - # [[u'error', u'Failed to launch instance "server_1": \ + # [['error', 'Failed to launch instance "server_1": \ # There is not enough capacity for this flavor in the \ # selected availability zone. Try again later or select \ - # a different availability zone.', u'']] + # a different availability zone.', '']] self.assertEqual(messages[0][0], 'error') self.assertTrue(messages[0][1].startswith('Failed')) diff --git a/openstack_dashboard/dashboards/project/key_pairs/tables.py b/openstack_dashboard/dashboards/project/key_pairs/tables.py index 2d4f0bb37..86a71571a 100644 --- a/openstack_dashboard/dashboards/project/key_pairs/tables.py +++ b/openstack_dashboard/dashboards/project/key_pairs/tables.py @@ -34,16 +34,16 @@ class DeleteKeyPairs(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Key Pair", - u"Delete Key Pairs", + "Delete Key Pair", + "Delete Key Pairs", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Key Pair", - u"Deleted Key Pairs", + "Deleted Key Pair", + "Deleted Key Pairs", count ) diff --git a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py index b305c89f4..6f0502cec 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/extensions/allowed_address_pairs/tables.py @@ -56,16 +56,16 @@ class DeleteAllowedAddressPair(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete", - u"Delete", + "Delete", + "Delete", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted address pair", - u"Deleted address pairs", + "Deleted address pair", + "Deleted address pairs", count ) diff --git a/openstack_dashboard/dashboards/project/networks/ports/tables.py b/openstack_dashboard/dashboards/project/networks/ports/tables.py index 6120a9d62..f172f1c07 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tables.py @@ -61,15 +61,15 @@ class UpdatePort(policy.PolicyTargetMixin, tables.LinkAction): DISPLAY_CHOICES = ( - ("UP", pgettext_lazy("Admin state of a Port", u"UP")), - ("DOWN", pgettext_lazy("Admin state of a Port", u"DOWN")), + ("UP", pgettext_lazy("Admin state of a Port", "UP")), + ("DOWN", pgettext_lazy("Admin state of a Port", "DOWN")), ) STATUS_DISPLAY_CHOICES = ( - ("ACTIVE", pgettext_lazy("status of a network port", u"Active")), - ("DOWN", pgettext_lazy("status of a network port", u"Down")), - ("ERROR", pgettext_lazy("status of a network port", u"Error")), - ("BUILD", pgettext_lazy("status of a network port", u"Build")), + ("ACTIVE", pgettext_lazy("status of a network port", "Active")), + ("DOWN", pgettext_lazy("status of a network port", "Down")), + ("ERROR", pgettext_lazy("status of a network port", "Error")), + ("BUILD", pgettext_lazy("status of a network port", "Build")), ) @@ -107,16 +107,16 @@ class DeletePort(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Port", - u"Delete Ports", + "Delete Port", + "Delete Ports", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Port", - u"Deleted Ports", + "Deleted Port", + "Deleted Ports", count ) diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tables.py b/openstack_dashboard/dashboards/project/networks/subnets/tables.py index 3a6769eca..d0be38141 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tables.py @@ -60,16 +60,16 @@ class DeleteSubnet(SubnetPolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Subnet", - u"Delete Subnets", + "Delete Subnet", + "Delete Subnets", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Subnet", - u"Deleted Subnets", + "Deleted Subnet", + "Deleted Subnets", count ) diff --git a/openstack_dashboard/dashboards/project/networks/tables.py b/openstack_dashboard/dashboards/project/networks/tables.py index a98cb1633..cdf63e8a4 100644 --- a/openstack_dashboard/dashboards/project/networks/tables.py +++ b/openstack_dashboard/dashboards/project/networks/tables.py @@ -39,16 +39,16 @@ class DeleteNetwork(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Network", - u"Delete Networks", + "Delete Network", + "Delete Networks", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Network", - u"Deleted Networks", + "Deleted Network", + "Deleted Networks", count ) @@ -157,14 +157,14 @@ def get_network_link(network): DISPLAY_CHOICES = ( - ("up", pgettext_lazy("Admin state of a Network", u"UP")), - ("down", pgettext_lazy("Admin state of a Network", u"DOWN")), + ("up", pgettext_lazy("Admin state of a Network", "UP")), + ("down", pgettext_lazy("Admin state of a Network", "DOWN")), ) STATUS_DISPLAY_CHOICES = ( - ("active", pgettext_lazy("Current status of a Network", u"Active")), - ("build", pgettext_lazy("Current status of a Network", u"Build")), - ("down", pgettext_lazy("Current status of a Network", u"Down")), - ("error", pgettext_lazy("Current status of a Network", u"Error")), + ("active", pgettext_lazy("Current status of a Network", "Active")), + ("build", pgettext_lazy("Current status of a Network", "Build")), + ("down", pgettext_lazy("Current status of a Network", "Down")), + ("error", pgettext_lazy("Current status of a Network", "Error")), ) diff --git a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py index 9dff61dfe..77d32aed0 100644 --- a/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py +++ b/openstack_dashboard/dashboards/project/routers/extensions/extraroutes/tables.py @@ -40,16 +40,16 @@ class RemoveRouterRoute(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Static Route", - u"Delete Static Routes", + "Delete Static Route", + "Delete Static Routes", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Static Route", - u"Deleted Static Routes", + "Deleted Static Route", + "Deleted Static Routes", count ) failure_url = 'horizon:project:routers:detail' diff --git a/openstack_dashboard/dashboards/project/routers/ports/tables.py b/openstack_dashboard/dashboards/project/routers/ports/tables.py index 744c039d7..d07bf7976 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/tables.py +++ b/openstack_dashboard/dashboards/project/routers/ports/tables.py @@ -53,16 +53,16 @@ class RemoveInterface(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Interface", - u"Delete Interfaces", + "Delete Interface", + "Delete Interfaces", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Interface", - u"Deleted Interfaces", + "Deleted Interface", + "Deleted Interfaces", count ) @@ -95,15 +95,15 @@ class RemoveInterface(policy.PolicyTargetMixin, tables.DeleteAction): DISPLAY_CHOICES = ( - ("UP", pgettext_lazy("Admin state of a Port", u"UP")), - ("DOWN", pgettext_lazy("Admin state of a Port", u"DOWN")), + ("UP", pgettext_lazy("Admin state of a Port", "UP")), + ("DOWN", pgettext_lazy("Admin state of a Port", "DOWN")), ) STATUS_DISPLAY_CHOICES = ( - ("ACTIVE", pgettext_lazy("current status of port", u"Active")), - ("BUILD", pgettext_lazy("current status of port", u"Build")), - ("DOWN", pgettext_lazy("current status of port", u"Down")), - ("ERROR", pgettext_lazy("current status of port", u"Error")), - ("N/A", pgettext_lazy("current status of port", u"N/A")), + ("ACTIVE", pgettext_lazy("current status of port", "Active")), + ("BUILD", pgettext_lazy("current status of port", "Build")), + ("DOWN", pgettext_lazy("current status of port", "Down")), + ("ERROR", pgettext_lazy("current status of port", "Error")), + ("N/A", pgettext_lazy("current status of port", "N/A")), ) diff --git a/openstack_dashboard/dashboards/project/routers/tables.py b/openstack_dashboard/dashboards/project/routers/tables.py index 5a9631550..32631b5c1 100644 --- a/openstack_dashboard/dashboards/project/routers/tables.py +++ b/openstack_dashboard/dashboards/project/routers/tables.py @@ -37,16 +37,16 @@ class DeleteRouter(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Router", - u"Delete Routers", + "Delete Router", + "Delete Routers", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Router", - u"Deleted Routers", + "Deleted Router", + "Deleted Routers", count ) @@ -128,16 +128,16 @@ class ClearGateway(policy.PolicyTargetMixin, tables.BatchAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Clear Gateway", - u"Clear Gateways", + "Clear Gateway", + "Clear Gateways", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Cleared Gateway", - u"Cleared Gateways", + "Cleared Gateway", + "Cleared Gateways", count ) @@ -202,12 +202,12 @@ class RoutersFilterAction(tables.FilterAction): STATUS_DISPLAY_CHOICES = ( - ("active", pgettext_lazy("current status of router", u"Active")), - ("error", pgettext_lazy("current status of router", u"Error")), + ("active", pgettext_lazy("current status of router", "Active")), + ("error", pgettext_lazy("current status of router", "Error")), ) ADMIN_STATE_DISPLAY_CHOICES = ( - ("up", pgettext_lazy("Admin state of a Router", u"UP")), - ("down", pgettext_lazy("Admin state of a Router", u"DOWN")), + ("up", pgettext_lazy("Admin state of a Router", "UP")), + ("down", pgettext_lazy("Admin state of a Router", "DOWN")), ) diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index 614211ac3..946ea3774 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -98,7 +98,7 @@ class IndexView(tables.DataTableView): # Translators: The usage is "<UUID of ext_net> (Not Found)" gateway_info['network'] = pgettext_lazy( 'External network not found', - u'%s (Not Found)') % ext_net_id + '%s (Not Found)') % ext_net_id class DetailView(tabs.TabbedTableView): diff --git a/openstack_dashboard/dashboards/project/security_groups/tables.py b/openstack_dashboard/dashboards/project/security_groups/tables.py index f8c3a8aed..7064571da 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tables.py +++ b/openstack_dashboard/dashboards/project/security_groups/tables.py @@ -36,16 +36,16 @@ class DeleteGroup(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Security Group", - u"Delete Security Groups", + "Delete Security Group", + "Delete Security Groups", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Security Group", - u"Deleted Security Groups", + "Deleted Security Group", + "Deleted Security Groups", count ) @@ -152,16 +152,16 @@ class DeleteRule(tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Rule", - u"Delete Rules", + "Delete Rule", + "Delete Rules", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Deleted Rule", - u"Deleted Rules", + "Deleted Rule", + "Deleted Rules", count ) @@ -195,7 +195,7 @@ def get_port_range(rule): ip_proto = rule.ip_protocol if rule.from_port == rule.to_port: return check_rule_template(rule.from_port, ip_proto) - return (u"%(from)s - %(to)s" % + return ("%(from)s - %(to)s" % {'from': check_rule_template(rule.from_port, ip_proto), 'to': check_rule_template(rule.to_port, ip_proto)}) @@ -221,7 +221,7 @@ def check_rule_template(port, ip_proto): str(port) == rule['to_port'] and ip_proto == rule['ip_protocol'])] if templ_rule: - return u"%(from_port)s (%(name)s)" % templ_rule[0] + return "%(from_port)s (%(name)s)" % templ_rule[0] return port diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py index 90694d0ed..8ab3c3d13 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/security_groups/tests.py @@ -189,7 +189,7 @@ class SecurityGroupsViewTests(test.TestCase): kwargs.get('from_port', int(rule.from_port)), kwargs.get('to_port', int(rule.to_port)), kwargs.get('cidr', rule.ip_range['cidr']), - kwargs.get('security_group', u'%s' % sec_group.id), + kwargs.get('security_group', '%s' % sec_group.id), **extra_params) self.mock_security_group_list.assert_called_once_with( test.IsHttpRequest()) @@ -510,7 +510,7 @@ class SecurityGroupsViewTests(test.TestCase): int(rule.from_port), int(rule.to_port), None, - u'%s' % sec_group.id, + '%s' % sec_group.id, description='') self.mock_security_group_list.assert_called_once_with( test.IsHttpRequest()) @@ -549,7 +549,7 @@ class SecurityGroupsViewTests(test.TestCase): int(rule.from_port), int(rule.to_port), None, - u'%s' % sec_group.id, + '%s' % sec_group.id, description='') self.mock_security_group_list.assert_called_once_with( test.IsHttpRequest()) @@ -971,7 +971,7 @@ class SecurityGroupsViewTests(test.TestCase): int(rule.from_port), int(rule.to_port), None, - u'%s' % sec_group.id, + '%s' % sec_group.id, description='') self.mock_security_group_list.assert_called_once_with( test.IsHttpRequest()) diff --git a/openstack_dashboard/dashboards/project/snapshots/tables.py b/openstack_dashboard/dashboards/project/snapshots/tables.py index d841d3196..9fd925954 100644 --- a/openstack_dashboard/dashboards/project/snapshots/tables.py +++ b/openstack_dashboard/dashboards/project/snapshots/tables.py @@ -76,16 +76,16 @@ class DeleteVolumeSnapshot(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Volume Snapshot", - u"Delete Volume Snapshots", + "Delete Volume Snapshot", + "Delete Volume Snapshots", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled deletion of Volume Snapshot", - u"Scheduled deletion of Volume Snapshots", + "Scheduled deletion of Volume Snapshot", + "Scheduled deletion of Volume Snapshots", count ) diff --git a/openstack_dashboard/dashboards/project/vg_snapshots/tables.py b/openstack_dashboard/dashboards/project/vg_snapshots/tables.py index 82767bb61..25923d7c5 100644 --- a/openstack_dashboard/dashboards/project/vg_snapshots/tables.py +++ b/openstack_dashboard/dashboards/project/vg_snapshots/tables.py @@ -37,16 +37,16 @@ class DeleteGroupSnapshot(policy.PolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Snapshot", - u"Delete Snapshots", + "Delete Snapshot", + "Delete Snapshots", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled deletion of Snapshot", - u"Scheduled deletion of Snapshots", + "Scheduled deletion of Snapshot", + "Scheduled deletion of Snapshots", count ) @@ -99,13 +99,13 @@ class GroupSnapshotsTable(tables.DataTable): STATUS_DISPLAY_CHOICES = ( ("available", pgettext_lazy("Current status of Volume Group Snapshot", - u"Available")), + "Available")), ("in-use", pgettext_lazy("Current status of Volume Group Snapshot", - u"In-use")), + "In-use")), ("error", pgettext_lazy("Current status of Volume Group Snapshot", - u"Error")), + "Error")), ) name = tables.Column("name_or_id", diff --git a/openstack_dashboard/dashboards/project/volume_groups/tables.py b/openstack_dashboard/dashboards/project/volume_groups/tables.py index 69b1ebe0e..7cfbf94fd 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/tables.py +++ b/openstack_dashboard/dashboards/project/volume_groups/tables.py @@ -139,15 +139,15 @@ class GroupsTable(tables.DataTable): ) STATUS_DISPLAY_CHOICES = ( ("available", - pgettext_lazy("Current status of Volume Group", u"Available")), + pgettext_lazy("Current status of Volume Group", "Available")), ("in-use", - pgettext_lazy("Current status of Volume Group", u"In-use")), + pgettext_lazy("Current status of Volume Group", "In-use")), ("error", - pgettext_lazy("Current status of Volume Group", u"Error")), + pgettext_lazy("Current status of Volume Group", "Error")), ("updating", - pgettext_lazy("Current status of Volume Group", u"Updating")), + pgettext_lazy("Current status of Volume Group", "Updating")), ("deleting", - pgettext_lazy("Current status of Volume Group", u"Deleting")), + pgettext_lazy("Current status of Volume Group", "Deleting")), ) name = tables.WrappingColumn("name_or_id", diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index 6a0cbdb9e..3622201e9 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -706,7 +706,7 @@ class UploadToImageForm(forms.SelfHandlingForm): required=False) force = forms.BooleanField( label=pgettext_lazy("Force upload volume in in-use status to image", - u"Force"), + "Force"), widget=forms.CheckboxInput(), required=False) diff --git a/openstack_dashboard/dashboards/project/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/tables.py index 01e7c03f2..6db77eefe 100644 --- a/openstack_dashboard/dashboards/project/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/tables.py @@ -98,16 +98,16 @@ class DeleteVolume(VolumePolicyTargetMixin, tables.DeleteAction): @staticmethod def action_present(count): return ungettext_lazy( - u"Delete Volume", - u"Delete Volumes", + "Delete Volume", + "Delete Volumes", count ) @staticmethod def action_past(count): return ungettext_lazy( - u"Scheduled deletion of Volume", - u"Scheduled deletion of Volumes", + "Scheduled deletion of Volume", + "Scheduled deletion of Volumes", count ) @@ -467,35 +467,35 @@ class VolumesTableBase(tables.DataTable): ) STATUS_DISPLAY_CHOICES = ( ("available", pgettext_lazy("Current status of a Volume", - u"Available")), - ("in-use", pgettext_lazy("Current status of a Volume", u"In-use")), - ("error", pgettext_lazy("Current status of a Volume", u"Error")), + "Available")), + ("in-use", pgettext_lazy("Current status of a Volume", "In-use")), + ("error", pgettext_lazy("Current status of a Volume", "Error")), ("creating", pgettext_lazy("Current status of a Volume", - u"Creating")), + "Creating")), ("error_extending", pgettext_lazy("Current status of a Volume", - u"Error Extending")), + "Error Extending")), ("extending", pgettext_lazy("Current status of a Volume", - u"Extending")), + "Extending")), ("attaching", pgettext_lazy("Current status of a Volume", - u"Attaching")), + "Attaching")), ("detaching", pgettext_lazy("Current status of a Volume", - u"Detaching")), + "Detaching")), ("deleting", pgettext_lazy("Current status of a Volume", - u"Deleting")), + "Deleting")), ("error_deleting", pgettext_lazy("Current status of a Volume", - u"Error deleting")), + "Error deleting")), ("backing-up", pgettext_lazy("Current status of a Volume", - u"Backing Up")), + "Backing Up")), ("restoring-backup", pgettext_lazy("Current status of a Volume", - u"Restoring Backup")), + "Restoring Backup")), ("error_restoring", pgettext_lazy("Current status of a Volume", - u"Error Restoring")), + "Error Restoring")), ("maintenance", pgettext_lazy("Current status of a Volume", - u"Maintenance")), + "Maintenance")), ("reserved", pgettext_lazy("Current status of a Volume", - u"Reserved")), + "Reserved")), ("awaiting-transfer", pgettext_lazy("Current status of a Volume", - u"Awaiting Transfer")), + "Awaiting Transfer")), ) name = tables.Column("name", verbose_name=_("Name"), @@ -598,8 +598,8 @@ class DetachVolume(tables.BatchAction): def action_present(count): return npgettext_lazy( "Action to perform (the volume is currently attached)", - u"Detach Volume", - u"Detach Volumes", + "Detach Volume", + "Detach Volumes", count ) @@ -608,8 +608,8 @@ class DetachVolume(tables.BatchAction): def action_past(count): return npgettext_lazy( "Past action (the volume is currently being detached)", - u"Detaching Volume", - u"Detaching Volumes", + "Detaching Volume", + "Detaching Volumes", count ) diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index ce98a7181..896a4a9d2 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -229,9 +229,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): volume = self.cinder_volumes.first() volume_type = self.cinder_volume_types.first() az = self.cinder_availability_zones.first().zoneName - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'type': volume_type.name, 'size': 50, 'snapshot_source': '', @@ -299,8 +299,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): volume_type = self.cinder_volume_types.first() az = self.cinder_availability_zones.first().zoneName formData = {'name': '', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'type': volume_type.name, 'size': 50, 'snapshot_source': '', @@ -362,9 +362,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): }) def test_create_volume_dropdown(self): volume = self.cinder_volumes.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 50, 'type': '', 'volume_source_type': 'no_source_type', @@ -428,9 +428,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_create_volume_from_snapshot(self): volume = self.cinder_volumes.first() snapshot = self.cinder_volume_snapshots.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 50, 'type': '', 'snapshot_source': snapshot.id} @@ -486,9 +486,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_create_volume_from_volume(self): volume = self.cinder_volumes.first() - formData = {'name': u'A copy of a volume', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A copy of a volume', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 50, 'type': '', 'volume_source_type': 'volume_source', @@ -559,9 +559,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_create_volume_from_snapshot_dropdown(self): volume = self.cinder_volumes.first() snapshot = self.cinder_volume_snapshots.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 50, 'type': '', 'volume_source_type': 'snapshot_source', @@ -625,9 +625,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): }) def test_create_volume_from_snapshot_invalid_size(self): snapshot = self.cinder_volume_snapshots.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 20, 'snapshot_source': snapshot.id} self.mock_volume_type_list.return_value = \ @@ -670,9 +670,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_create_volume_from_image(self): volume = self.cinder_volumes.first() image = self.images.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 40, 'type': '', 'image_source': image.id} @@ -730,9 +730,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): def test_create_volume_from_image_dropdown(self): volume = self.cinder_volumes.first() image = self.images.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 30, 'type': '', 'volume_source_type': 'image_source', @@ -798,9 +798,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): }) def test_create_volume_from_image_under_image_size(self): image = self.images.first() - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 1, 'image_source': image.id} self.mock_volume_type_list.return_value = \ @@ -819,8 +819,8 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): formData, follow=True) self.assertEqual(res.redirect_chain, []) - msg = (u"The volume size cannot be less than the " - u"image size (20.0\xa0GB)") + msg = ("The volume size cannot be less than the " + "image size (20.0\xa0GB)") self.assertFormError(res, 'form', None, msg) @@ -844,9 +844,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): 'group_list'], }) def _test_create_volume_from_image_under_image_min_disk_size(self, image): - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'size': 5, 'image_source': image.id} self.mock_volume_type_list.return_value = \ @@ -900,9 +900,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): 'group_list'], }) def test_create_volume_gb_used_over_alloted_quota(self): - formData = {'name': u'This Volume Is Huge!', - 'description': u'This is a volume that is just too big!', - 'method': u'CreateForm', + formData = {'name': 'This Volume Is Huge!', + 'description': 'This is a volume that is just too big!', + 'method': 'CreateForm', 'size': 5000} usage_limit = self.cinder_quota_usages.first() @@ -929,7 +929,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): url = reverse('horizon:project:volumes:create') res = self.client.post(url, formData) - expected_error = [u'A volume of 5000GiB cannot be created as you only' + expected_error = ['A volume of 5000GiB cannot be created as you only' ' have 20GiB of your quota available.'] self.assertEqual(res.context['form'].errors['__all__'], expected_error) @@ -960,9 +960,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): 'group_list'], }) def test_create_volume_number_over_alloted_quota(self): - formData = {'name': u'Too Many...', - 'description': u'We have no volumes left!', - 'method': u'CreateForm', + formData = {'name': 'Too Many...', + 'description': 'We have no volumes left!', + 'method': 'CreateForm', 'size': 10} usage_limit = self.cinder_quota_usages.first() @@ -990,7 +990,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): url = reverse('horizon:project:volumes:create') res = self.client.post(url, formData) - expected_error = [u'You are already using all of your available' + expected_error = ['You are already using all of your available' ' volumes.'] self.assertEqual(res.context['form'].errors['__all__'], expected_error) @@ -1022,9 +1022,9 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): volume_type = self.cinder_volume_types.first() az = self.cinder_availability_zones.first().zoneName volume_group = self.cinder_groups.list()[0] - formData = {'name': u'A Volume I Am Making', - 'description': u'This is a volume I am making for a test.', - 'method': u'CreateForm', + formData = {'name': 'A Volume I Am Making', + 'description': 'This is a volume I am making for a test.', + 'method': 'CreateForm', 'type': volume_type.name, 'size': 50, 'snapshot_source': '', @@ -1736,7 +1736,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): @mock.patch.object(cinder, 'volume_get') def test_extend_volume(self, mock_get, mock_extend, mock_quotas): volume = self.cinder_volumes.first() - formData = {'name': u'A Volume I Am Making', + formData = {'name': 'A Volume I Am Making', 'orig_size': volume.size, 'new_size': 120} @@ -1760,7 +1760,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): @mock.patch.object(cinder, 'volume_get') def test_extend_volume_with_wrong_size(self, mock_get, mock_quotas): volume = self.cinder_volumes.first() - formData = {'name': u'A Volume I Am Making', + formData = {'name': 'A Volume I Am Making', 'orig_size': volume.size, 'new_size': 10} @@ -1895,7 +1895,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): usage_limit.tally('gigabytes', 20) usage_limit.tally('volumes', len(self.cinder_volumes.list())) - formData = {'name': u'A Volume I Am Making', + formData = {'name': 'A Volume I Am Making', 'orig_size': volume.size, 'new_size': 1000} @@ -1957,7 +1957,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): volumes = self.cinder_volumes.list() volToTransfer = [v for v in volumes if v.status == 'available'][0] formData = {'volume_id': volToTransfer.id, - 'name': u'any transfer name'} + 'name': 'any transfer name'} transfer = self.cinder_volume_transfers.first() mock_transfer_create.return_value = transfer |