From ec727ac39426c2a6be70a7c9cf75c00e4ae0c91c Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 5 Sep 2013 14:38:58 +0800 Subject: [PATCH] PEP8 E121 has been resolved Change-Id: I6ad2704100447c5a3be12c2ebeec824726e3bd0b Partial-Bug: #1085346 --- horizon/management/commands/startdash.py | 20 ++-- horizon/management/commands/startpanel.py | 34 +++---- openstack_dashboard/api/nova.py | 2 +- .../dashboards/admin/flavors/workflows.py | 8 +- .../dashboards/admin/instances/tests.py | 4 +- .../dashboards/admin/networks/ports/forms.py | 2 +- .../dashboards/admin/projects/views.py | 19 ++-- .../dashboards/admin/users/tables.py | 2 +- .../security_groups/forms.py | 70 +++++++------- .../dashboards/project/containers/views.py | 2 +- .../dashboards/project/databases/tables.py | 2 +- .../images_and_snapshots/images/forms.py | 24 ++--- .../project/images_and_snapshots/tests.py | 22 ++--- .../dashboards/project/instances/views.py | 2 +- .../instances/workflows/resize_instance.py | 2 +- .../project/networks/subnets/tables.py | 2 +- .../dashboards/project/networks/views.py | 2 +- .../dashboards/project/volumes/forms.py | 36 +++---- openstack_dashboard/test/helpers.py | 4 +- .../test/test_data/keystone_data.py | 94 +++++++++---------- tox.ini | 3 +- 21 files changed, 179 insertions(+), 177 deletions(-) diff --git a/horizon/management/commands/startdash.py b/horizon/management/commands/startdash.py index 43127501dae..f2d5c635cfd 100644 --- a/horizon/management/commands/startdash.py +++ b/horizon/management/commands/startdash.py @@ -12,16 +12,16 @@ class Command(TemplateCommand): template = os.path.join(horizon.__path__[0], "conf", "dash_template") option_list = TemplateCommand.option_list + ( - make_option('--target', - dest='target', - action='store', - default=None, - help='The directory in which the panel ' - 'should be created. Defaults to the ' - 'current directory. The value "auto" ' - 'may also be used to automatically ' - 'create the panel inside the specified ' - 'dashboard module.'),) + make_option('--target', + dest='target', + action='store', + default=None, + help='The directory in which the panel ' + 'should be created. Defaults to the ' + 'current directory. The value "auto" ' + 'may also be used to automatically ' + 'create the panel inside the specified ' + 'dashboard module.'),) help = ("Creates a Django app directory structure for a new dashboard " "with the given name in the current directory or optionally in " "the given directory.") diff --git a/horizon/management/commands/startpanel.py b/horizon/management/commands/startpanel.py index 33944f7439c..d6e11b36695 100644 --- a/horizon/management/commands/startpanel.py +++ b/horizon/management/commands/startpanel.py @@ -12,23 +12,23 @@ class Command(TemplateCommand): args = "[name] [dashboard name] [optional destination directory]" option_list = TemplateCommand.option_list + ( - make_option('--dashboard', '-d', - dest='dashboard', - action='store', - default=None, - help='The dotted python path to the ' - 'dashboard which this panel will be ' - 'registered with.'), - make_option('--target', - dest='target', - action='store', - default=None, - help='The directory in which the panel ' - 'should be created. Defaults to the ' - 'current directory. The value "auto" ' - 'may also be used to automatically ' - 'create the panel inside the specified ' - 'dashboard module.'),) + make_option('--dashboard', '-d', + dest='dashboard', + action='store', + default=None, + help='The dotted python path to the ' + 'dashboard which this panel will be ' + 'registered with.'), + make_option('--target', + dest='target', + action='store', + default=None, + help='The directory in which the panel ' + 'should be created. Defaults to the ' + 'current directory. The value "auto" ' + 'may also be used to automatically ' + 'create the panel inside the specified ' + 'dashboard module.'),) template = os.path.join(horizon.__path__[0], "conf", "panel_template") help = ("Creates a Django app directory structure for a new panel " "with the given name in the current directory or optionally in " diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index 79d2164bc39..57a2589e974 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -234,7 +234,7 @@ def list_by_instance(self, instance_id): # Wrap data in SG objects as novaclient would. sg_objs = [nova_security_groups.SecurityGroup( nclient.security_groups, sg, loaded=True) - for sg in body.get('security_groups', [])] + for sg in body.get('security_groups', [])] # Then wrap novaclient's object with our own. Yes, sadly wrapping # with two layers of objects is necessary. security_groups = [SecurityGroup(sg) for sg in sg_objs] diff --git a/openstack_dashboard/dashboards/admin/flavors/workflows.py b/openstack_dashboard/dashboards/admin/flavors/workflows.py index 4475bcfa256..2bc8f6b44fc 100644 --- a/openstack_dashboard/dashboards/admin/flavors/workflows.py +++ b/openstack_dashboard/dashboards/admin/flavors/workflows.py @@ -72,13 +72,13 @@ def clean(self): for flavor in flavors: if flavor.name == name: raise forms.ValidationError( - _('The name "%s" is already used by another flavor.') - % name + _('The name "%s" is already used by another flavor.') + % name ) if flavor.id == flavor_id: raise forms.ValidationError( - _('The ID "%s" is already used by another flavor.') - % flavor_id + _('The ID "%s" is already used by another flavor.') + % flavor_id ) return cleaned_data diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index 74fc85d6113..45277af2afc 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -165,7 +165,7 @@ def test_ajax_loading_instances(self): api.keystone: ('tenant_list',)}) def test_index_options_before_migrate(self): api.keystone.tenant_list(IsA(http.HttpRequest)).\ - AndReturn([self.tenants.list(), False]) + AndReturn([self.tenants.list(), False]) search_opts = {'marker': None, 'paginate': True} api.nova.server_list(IsA(http.HttpRequest), all_tenants=True, search_opts=search_opts) \ @@ -173,7 +173,7 @@ def test_index_options_before_migrate(self): api.nova.extension_supported('AdminActions', IsA(http.HttpRequest)) \ .MultipleTimes().AndReturn(True) api.nova.flavor_list(IsA(http.HttpRequest)).\ - AndReturn(self.flavors.list()) + AndReturn(self.flavors.list()) self.mox.ReplayAll() res = self.client.get(reverse('horizon:admin:instances:index')) diff --git a/openstack_dashboard/dashboards/admin/networks/ports/forms.py b/openstack_dashboard/dashboards/admin/networks/ports/forms.py index 5944be9dc08..ff8eacdbf93 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/forms.py @@ -67,7 +67,7 @@ def handle(self, request, data): return port except Exception: msg = _('Failed to create a port for network %s') \ - % data['network_id'] + % data['network_id'] LOG.info(msg) redirect = reverse('horizon:admin:networks:detail', args=(data['network_id'],)) diff --git a/openstack_dashboard/dashboards/admin/projects/views.py b/openstack_dashboard/dashboards/admin/projects/views.py index 8aee66fd150..13eebcd992d 100644 --- a/openstack_dashboard/dashboards/admin/projects/views.py +++ b/openstack_dashboard/dashboards/admin/projects/views.py @@ -82,10 +82,10 @@ def get_data(self): domain_context = self.request.session.get('domain_context', None) try: tenants, self._more = api.keystone.tenant_list( - self.request, - domain=domain_context, - paginate=True, - marker=marker) + self.request, + domain=domain_context, + paginate=True, + marker=marker) except Exception: self._more = False exceptions.handle(self.request, @@ -120,14 +120,15 @@ def get_initial(self): try: if api.base.is_service_enabled(self.request, 'network') and \ - api.neutron.is_quotas_extension_supported(self.request): + api.neutron.is_quotas_extension_supported( + self.request): # TODO(jpichon): There is no API to access the Neutron # default quotas (LP#1204956). For now, use the values # from the current project. project_id = self.request.user.project_id quota_defaults += api.neutron.tenant_quota_get( - self.request, - tenant_id=project_id) + self.request, + tenant_id=project_id) except Exception: error_msg = _('Unable to retrieve default Neutron quota ' 'values.') @@ -167,8 +168,8 @@ def get_initial(self): initial["domain_name"] = domain.name except Exception: exceptions.handle(self.request, - _('Unable to retrieve project domain.'), - redirect=reverse(INDEX_URL)) + _('Unable to retrieve project domain.'), + redirect=reverse(INDEX_URL)) # get initial project quota quota_data = quotas.get_tenant_quota_data(self.request, diff --git a/openstack_dashboard/dashboards/admin/users/tables.py b/openstack_dashboard/dashboards/admin/users/tables.py index 7f7604664e8..35bdc487893 100644 --- a/openstack_dashboard/dashboards/admin/users/tables.py +++ b/openstack_dashboard/dashboards/admin/users/tables.py @@ -96,7 +96,7 @@ class DeleteUsersAction(tables.DeleteAction): def allowed(self, request, datum): if not api.keystone.keystone_can_edit_user() or \ - (datum and datum.id == request.user.id): + (datum and datum.id == request.user.id): return False return True diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py index a44e43fcda2..b4179dd85b5 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py @@ -44,9 +44,9 @@ class CreateGroup(forms.SelfHandlingForm): name = forms.CharField(label=_("Name"), error_messages={ - 'required': _('This field is required.'), - 'invalid': _("The string may only contain" - " ASCII characters and numbers.")}, + 'required': _('This field is required.'), + 'invalid': _("The string may only contain" + " ASCII characters and numbers.")}, validators=[validators.validate_slug]) description = forms.CharField(label=_("Description")) @@ -70,9 +70,9 @@ class UpdateGroup(forms.SelfHandlingForm): id = forms.CharField(widget=forms.HiddenInput()) name = forms.CharField(label=_("Name"), error_messages={ - 'required': _('This field is required.'), - 'invalid': _("The string may only contain" - " ASCII characters and numbers.")}, + 'required': _('This field is required.'), + 'invalid': _("The string may only contain" + " ASCII characters and numbers.")}, validators=[validators.validate_slug]) description = forms.CharField(label=_("Description")) @@ -133,20 +133,20 @@ class AddRule(forms.SelfHandlingForm): choices=[('port', _('Port')), ('range', _('Port Range'))], widget=forms.Select(attrs={ - 'class': 'switchable switched', - 'data-slug': 'range', - 'data-switch-on': 'rule_menu', - 'data-rule_menu-tcp': _('Open Port'), - 'data-rule_menu-udp': _('Open Port')})) + 'class': 'switchable switched', + 'data-slug': 'range', + 'data-switch-on': 'rule_menu', + 'data-rule_menu-tcp': _('Open Port'), + 'data-rule_menu-udp': _('Open Port')})) port = forms.IntegerField(label=_("Port"), required=False, help_text=_("Enter an integer value " "between 1 and 65535."), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'range', - 'data-range-port': _('Port')}), + 'class': 'switched', + 'data-switch-on': 'range', + 'data-range-port': _('Port')}), validators=[ utils_validators.validate_port_range]) @@ -155,9 +155,9 @@ class AddRule(forms.SelfHandlingForm): help_text=_("Enter an integer value " "between 1 and 65535."), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'range', - 'data-range-range': _('From Port')}), + 'class': 'switched', + 'data-switch-on': 'range', + 'data-range-range': _('From Port')}), validators=[ utils_validators.validate_port_range]) @@ -166,9 +166,9 @@ class AddRule(forms.SelfHandlingForm): help_text=_("Enter an integer value " "between 1 and 65535."), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'range', - 'data-range-range': _('To Port')}), + 'class': 'switched', + 'data-switch-on': 'range', + 'data-range-range': _('To Port')}), validators=[ utils_validators.validate_port_range]) @@ -177,9 +177,9 @@ class AddRule(forms.SelfHandlingForm): help_text=_("Enter a value for ICMP type " "in the range (-1: 255)"), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'rule_menu', - 'data-rule_menu-icmp': _('Type')}), + 'class': 'switched', + 'data-switch-on': 'rule_menu', + 'data-rule_menu-icmp': _('Type')}), validators=[ utils_validators.validate_port_range]) @@ -188,9 +188,9 @@ class AddRule(forms.SelfHandlingForm): help_text=_("Enter a value for ICMP code " "in the range (-1: 255)"), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'rule_menu', - 'data-rule_menu-icmp': _('Code')}), + 'class': 'switched', + 'data-switch-on': 'rule_menu', + 'data-rule_menu-icmp': _('Code')}), validators=[ utils_validators.validate_port_range]) @@ -204,8 +204,8 @@ class AddRule(forms.SelfHandlingForm): 'group select "Security ' 'Group".'), widget=forms.Select(attrs={ - 'class': 'switchable', - 'data-slug': 'remote'})) + 'class': 'switchable', + 'data-slug': 'remote'})) cidr = fields.IPField(label=_("CIDR"), required=False, @@ -215,17 +215,17 @@ class AddRule(forms.SelfHandlingForm): version=fields.IPv4 | fields.IPv6, mask=True, widget=forms.TextInput( - attrs={'class': 'switched', - 'data-switch-on': 'remote', - 'data-remote-cidr': _('CIDR')})) + attrs={'class': 'switched', + 'data-switch-on': 'remote', + 'data-remote-cidr': _('CIDR')})) security_group = forms.ChoiceField(label=_('Security Group'), required=False, widget=forms.Select(attrs={ - 'class': 'switched', - 'data-switch-on': 'remote', - 'data-remote-sg': _('Security ' - 'Group')})) + 'class': 'switched', + 'data-switch-on': 'remote', + 'data-remote-sg': _('Security ' + 'Group')})) # When cidr is used ethertype is determined from IP version of cidr. # When source group, ethertype needs to be specified explicitly. ethertype = forms.ChoiceField(label=_('Ether Type'), diff --git a/openstack_dashboard/dashboards/project/containers/views.py b/openstack_dashboard/dashboards/project/containers/views.py index df7e2150fb8..2fa12858927 100644 --- a/openstack_dashboard/dashboards/project/containers/views.py +++ b/openstack_dashboard/dashboards/project/containers/views.py @@ -196,7 +196,7 @@ def get_success_url(self): return reverse(self.success_url, args=(tables.wrap_delimiter(new_container_name), tables.wrap_delimiter( - self.request.POST.get('path', '')))) + self.request.POST.get('path', '')))) def get_form_kwargs(self): kwargs = super(CopyView, self).get_form_kwargs() diff --git a/openstack_dashboard/dashboards/project/databases/tables.py b/openstack_dashboard/dashboards/project/databases/tables.py index 4f44ca52b87..a506374c06e 100644 --- a/openstack_dashboard/dashboards/project/databases/tables.py +++ b/openstack_dashboard/dashboards/project/databases/tables.py @@ -27,7 +27,7 @@ from openstack_dashboard import api from openstack_dashboard.dashboards.project.database_backups \ - import tables as backup_tables + import tables as backup_tables LOG = logging.getLogger(__name__) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py index 74c11e50355..dc6c2c77fe0 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py @@ -54,24 +54,24 @@ class CreateImageForm(forms.SelfHandlingForm): choices=[('url', _('Image Location')), ('file', _('Image File'))], widget=forms.Select(attrs={ - 'class': 'switchable', - 'data-slug': 'source'})) + 'class': 'switchable', + 'data-slug': 'source'})) copy_from = forms.CharField(max_length="255", label=_("Image Location"), help_text=_("An external (HTTP) URL to load " "the image from."), widget=forms.TextInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'source', - 'data-source-url': _('Image Location')}), + 'class': 'switched', + 'data-switch-on': 'source', + 'data-source-url': _('Image Location')}), required=False) image_file = forms.FileField(label=_("Image File"), help_text=_("A local image to upload."), widget=forms.FileInput(attrs={ - 'class': 'switched', - 'data-switch-on': 'source', - 'data-source-file': _('Image File')}), + 'class': 'switched', + 'data-switch-on': 'source', + 'data-source-file': _('Image File')}), required=False) disk_format = forms.ChoiceField(label=_('Format'), required=True, @@ -158,20 +158,20 @@ class UpdateImageForm(forms.SelfHandlingForm): kernel = forms.CharField(max_length="36", label=_("Kernel ID"), required=False, widget=forms.TextInput( - attrs={'readonly': 'readonly'} + attrs={'readonly': 'readonly'} )) ramdisk = forms.CharField(max_length="36", label=_("Ramdisk ID"), required=False, widget=forms.TextInput( - attrs={'readonly': 'readonly'} + attrs={'readonly': 'readonly'} )) architecture = forms.CharField(label=_("Architecture"), required=False, widget=forms.TextInput( - attrs={'readonly': 'readonly'} + attrs={'readonly': 'readonly'} )) disk_format = forms.CharField(label=_("Format"), widget=forms.TextInput( - attrs={'readonly': 'readonly'} + attrs={'readonly': 'readonly'} )) public = forms.BooleanField(label=_("Public"), required=False) protected = forms.BooleanField(label=_("Protected"), required=False) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py b/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py index 3575c9dd790..ef513604330 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py @@ -42,10 +42,10 @@ def test_index(self): volume.volume_id = volume.id for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) api.cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ @@ -82,14 +82,14 @@ def test_index_no_images(self): volume.volume_id = volume.id for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) api.cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(volumes) + .AndReturn(volumes) api.glance.image_list_detailed(IsA(http.HttpRequest), marker=None).AndReturn([(), False]) self.mox.ReplayAll() @@ -106,17 +106,17 @@ def test_index_error(self): volume.volume_id = volume.id for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) api.cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ - .AndReturn(volumes) + .AndReturn(volumes) api.glance.image_list_detailed(IsA(http.HttpRequest), marker=None) \ - .AndRaise(self.exceptions.glance) + .AndRaise(self.exceptions.glance) self.mox.ReplayAll() res = self.client.get(INDEX_URL) @@ -132,10 +132,10 @@ def test_snapshot_actions(self): volume.volume_id = volume.id for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) for volume in volumes: api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) \ - .AndReturn(volume) + .AndReturn(volume) api.cinder.volume_get(IsA(http.HttpRequest), volume.volume_id) api.cinder.volume_snapshot_list(IsA(http.HttpRequest)) \ diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 3a96aba4353..50807d74043 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -210,7 +210,7 @@ def get_data(self): instance.full_flavor = api.nova.flavor_get( self.request, instance.flavor["id"]) instance.security_groups = api.network.server_security_groups( - self.request, instance_id) + self.request, instance_id) except Exception: redirect = reverse('horizon:project:instances:index') exceptions.handle(self.request, diff --git a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py index 9dd00ac1f7c..96ea0e1ce80 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py @@ -36,7 +36,7 @@ class SetFlavorChoiceAction(workflows.Action): old_flavor_name = forms.CharField(label=_("Old Flavor"), required=False, widget=forms.TextInput( - attrs={'readonly': 'readonly'} + attrs={'readonly': 'readonly'} )) flavor = forms.ChoiceField(label=_("New Flavor"), required=True, diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tables.py b/openstack_dashboard/dashboards/project/networks/subnets/tables.py index dfe044ef2c5..4db6a953add 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tables.py @@ -95,7 +95,7 @@ def _get_network(self): network.set_id_as_name_if_empty(length=0) except Exception: msg = _('Unable to retrieve details for network "%s".') \ - % (network_id) + % (network_id) exceptions.handle(self.request, msg, redirect=self.failure_url) self._network = network return self._network diff --git a/openstack_dashboard/dashboards/project/networks/views.py b/openstack_dashboard/dashboards/project/networks/views.py index cc2b176d3f1..419d03ba52d 100644 --- a/openstack_dashboard/dashboards/project/networks/views.py +++ b/openstack_dashboard/dashboards/project/networks/views.py @@ -138,7 +138,7 @@ def _get_data(self): network.set_id_as_name_if_empty(length=0) except Exception: msg = _('Unable to retrieve details for network "%s".') \ - % (network_id) + % (network_id) exceptions.handle(self.request, msg, redirect=self.failure_url) self._network = network return self._network diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index 4e1cb62c476..d4ff2fcd39a 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -36,23 +36,25 @@ class CreateForm(forms.SelfHandlingForm): size = forms.IntegerField(min_value=1, label=_("Size (GB)")) volume_source_type = forms.ChoiceField(label=_("Volume Source"), required=False) - snapshot_source = forms.ChoiceField(label=_("Use snapshot as a source"), - widget=fields.SelectWidget( - attrs={'class': 'snapshot-selector'}, - data_attrs=('size', 'display_name'), - transform=lambda x: - ("%s (%sGB)" % (x.display_name, - x.size))), - required=False) - image_source = forms.ChoiceField(label=_("Use image as a source"), - widget=fields.SelectWidget( - attrs={'class': 'image-selector'}, - data_attrs=('size', 'name'), - transform=lambda x: - ("%s (%s)" % - (x.name, - filesizeformat(x.bytes)))), - required=False) + snapshot_source = forms.ChoiceField( + label=_("Use snapshot as a source"), + widget=fields.SelectWidget( + attrs={'class': 'snapshot-selector'}, + data_attrs=('size', 'display_name'), + transform=lambda x: + ("%s (%sGB)" % (x.display_name, + x.size))), + required=False) + image_source = forms.ChoiceField( + label=_("Use image as a source"), + widget=fields.SelectWidget( + attrs={'class': 'image-selector'}, + data_attrs=('size', 'name'), + transform=lambda x: + ("%s (%s)" % + (x.name, + filesizeformat(x.bytes)))), + required=False) def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index 0f86317bc94..0f982f21f5d 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -207,8 +207,8 @@ def assertFormErrors(self, response, count=0, message=None, errors = response.context[context_name]._errors if count: assert len(errors) == count, \ - "%d errors were found on the form, %d expected" % \ - (len(errors), count) + "%d errors were found on the form, %d expected" % \ + (len(errors), count) if message and message not in unicode(errors): self.fail("Expected message not found, instead found: %s" % ["%s: %s" % (key, [e for e in field_errors]) for diff --git a/openstack_dashboard/test/test_data/keystone_data.py b/openstack_dashboard/test/test_data/keystone_data.py index aefc8966e4b..0dc7459fa57 100644 --- a/openstack_dashboard/test/test_data/keystone_data.py +++ b/openstack_dashboard/test/test_data/keystone_data.py @@ -38,66 +38,66 @@ "name": "nova", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.nova.example.com:8774/v2", - "internalURL": "http://int.nova.example.com:8774/v2", - "publicURL": "http://public.nova.example.com:8774/v2"}, - {"region": "RegionTwo", - "adminURL": "http://admin.nova2.example.com:8774/v2", - "internalURL": "http://int.nova2.example.com:8774/v2", - "publicURL": "http://public.nova2.example.com:8774/v2"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.nova.example.com:8774/v2", + "internalURL": "http://int.nova.example.com:8774/v2", + "publicURL": "http://public.nova.example.com:8774/v2"}, + {"region": "RegionTwo", + "adminURL": "http://admin.nova2.example.com:8774/v2", + "internalURL": "http://int.nova2.example.com:8774/v2", + "publicURL": "http://public.nova2.example.com:8774/v2"}]}, {"type": "volume", "name": "nova", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.nova.example.com:8776/v1", - "internalURL": "http://int.nova.example.com:8776/v1", - "publicURL": "http://public.nova.example.com:8776/v1"}, - {"region": "RegionTwo", - "adminURL": "http://admin.nova.example.com:8776/v1", - "internalURL": "http://int.nova.example.com:8776/v1", - "publicURL": "http://public.nova.example.com:8776/v1"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.nova.example.com:8776/v1", + "internalURL": "http://int.nova.example.com:8776/v1", + "publicURL": "http://public.nova.example.com:8776/v1"}, + {"region": "RegionTwo", + "adminURL": "http://admin.nova.example.com:8776/v1", + "internalURL": "http://int.nova.example.com:8776/v1", + "publicURL": "http://public.nova.example.com:8776/v1"}]}, {"type": "image", "name": "glance", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.glance.example.com:9292/v1", - "internalURL": "http://int.glance.example.com:9292/v1", - "publicURL": "http://public.glance.example.com:9292/v1"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.glance.example.com:9292/v1", + "internalURL": "http://int.glance.example.com:9292/v1", + "publicURL": "http://public.glance.example.com:9292/v1"}]}, {"type": "identity", "name": "keystone", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.keystone.example.com:35357/v2.0", - "internalURL": "http://int.keystone.example.com:5000/v2.0", - "publicURL": "http://public.keystone.example.com:5000/v2.0"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.keystone.example.com:35357/v2.0", + "internalURL": "http://int.keystone.example.com:5000/v2.0", + "publicURL": "http://public.keystone.example.com:5000/v2.0"}]}, {"type": "object-store", "name": "swift", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.swift.example.com:8080/", - "internalURL": "http://int.swift.example.com:8080/", - "publicURL": "http://public.swift.example.com:8080/"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.swift.example.com:8080/", + "internalURL": "http://int.swift.example.com:8080/", + "publicURL": "http://public.swift.example.com:8080/"}]}, {"type": "network", "name": "neutron", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.neutron.example.com:9696/", - "internalURL": "http://int.neutron.example.com:9696/", - "publicURL": "http://public.neutron.example.com:9696/"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.neutron.example.com:9696/", + "internalURL": "http://int.neutron.example.com:9696/", + "publicURL": "http://public.neutron.example.com:9696/"}]}, {"type": "ec2", "name": "EC2 Service", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.nova.example.com:8773/services/Admin", - "publicURL": "http://public.nova.example.com:8773/services/Cloud", - "internalURL": "http://int.nova.example.com:8773/services/Cloud"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.nova.example.com:8773/services/Admin", + "publicURL": "http://public.nova.example.com:8773/services/Cloud", + "internalURL": "http://int.nova.example.com:8773/services/Cloud"}]}, {"type": "metering", "name": "ceilometer", "endpoints_links": [], @@ -110,18 +110,18 @@ "name": "Heat", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.heat.example.com:8004/v1", - "publicURL": "http://public.heat.example.com:8004/v1", - "internalURL": "http://int.heat.example.com:8004/v1"}]}, + {"region": "RegionOne", + "adminURL": "http://admin.heat.example.com:8004/v1", + "publicURL": "http://public.heat.example.com:8004/v1", + "internalURL": "http://int.heat.example.com:8004/v1"}]}, {"type": "database", "name": "Trove", "endpoints_links": [], "endpoints": [ - {"region": "RegionOne", - "adminURL": "http://admin.trove.example.com:8779/v1.0", - "publicURL": "http://public.trove.example.com:8779/v1.0", - "internalURL": "http://int.trove.example.com:8779/v1.0"}]} + {"region": "RegionOne", + "adminURL": "http://admin.trove.example.com:8779/v1.0", + "publicURL": "http://public.trove.example.com:8779/v1.0", + "internalURL": "http://int.trove.example.com:8779/v1.0"}]} ] @@ -276,9 +276,9 @@ def data(TEST): 'id': "test_token_id", 'expires': expiration}, 'user': { - 'id': "test_user_id", - 'name': "test_user", - 'roles': [member_role_dict]}, + 'id': "test_user_id", + 'name': "test_user", + 'roles': [member_role_dict]}, 'serviceCatalog': TEST.service_catalog } } diff --git a/tox.ini b/tox.ini index 4cc1311060b..2cc5ad74d1d 100644 --- a/tox.ini +++ b/tox.ini @@ -32,7 +32,6 @@ downloadcache = ~/cache/pip [flake8] builtins = _ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py -# E121 continuation line indentation is not a multiple of four # E126 continuation line over-indented for hanging indent # E127 continuation line over-indented for visual indent # E128 continuation line under-indented for visual indent @@ -42,4 +41,4 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p # H4xx docstrings # H701 empty localization string # H702 Formatting operation should be outside of localization method call -ignore = E121,E126,E127,E128,F403,F999,H102,H4,H701,H702 +ignore = E126,E127,E128,F403,F999,H102,H4,H701,H702