Skip to content

Commit

Permalink
PEP8 E121 has been resolved
Browse files Browse the repository at this point in the history
Change-Id: I6ad2704100447c5a3be12c2ebeec824726e3bd0b
Partial-Bug: #1085346
  • Loading branch information
simon committed Sep 5, 2013
1 parent 858dfb2 commit ec727ac
Show file tree
Hide file tree
Showing 21 changed files with 179 additions and 177 deletions.
20 changes: 10 additions & 10 deletions horizon/management/commands/startdash.py
Expand Up @@ -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.")
Expand Down
34 changes: 17 additions & 17 deletions horizon/management/commands/startpanel.py
Expand Up @@ -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 "
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/api/nova.py
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions openstack_dashboard/dashboards/admin/flavors/workflows.py
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions openstack_dashboard/dashboards/admin/instances/tests.py
Expand Up @@ -165,15 +165,15 @@ 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) \
.AndReturn([self.servers.list(), False])
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'))
Expand Down
Expand Up @@ -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'],))
Expand Down
19 changes: 10 additions & 9 deletions openstack_dashboard/dashboards/admin/projects/views.py
Expand Up @@ -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,
Expand Down Expand Up @@ -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.')
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/admin/users/tables.py
Expand Up @@ -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

Expand Down
Expand Up @@ -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"))

Expand All @@ -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"))

Expand Down Expand Up @@ -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])

Expand All @@ -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])

Expand All @@ -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])

Expand All @@ -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])

Expand All @@ -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])

Expand All @@ -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,
Expand All @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/project/containers/views.py
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion openstack_dashboard/dashboards/project/databases/tables.py
Expand Up @@ -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__)
Expand Down

0 comments on commit ec727ac

Please sign in to comment.