PEP8 E121 has been resolved
Change-Id: I6ad2704100447c5a3be12c2ebeec824726e3bd0b Partial-Bug: #1085346
This commit is contained in:
parent
858dfb2c73
commit
ec727ac394
@ -12,16 +12,16 @@ import horizon
|
||||
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.")
|
||||
|
@ -12,23 +12,23 @@ import horizon
|
||||
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 "
|
||||
|
@ -234,7 +234,7 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
|
||||
# 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]
|
||||
|
@ -72,13 +72,13 @@ class CreateFlavorInfoAction(workflows.Action):
|
||||
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
|
||||
|
||||
|
@ -165,7 +165,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
||||
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 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
||||
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'))
|
||||
|
@ -67,7 +67,7 @@ class CreatePort(forms.SelfHandlingForm):
|
||||
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'],))
|
||||
|
@ -82,10 +82,10 @@ class IndexView(tables.DataTableView):
|
||||
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 @@ class CreateProjectView(workflows.WorkflowView):
|
||||
|
||||
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 @@ class UpdateProjectView(workflows.WorkflowView):
|
||||
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,
|
||||
|
@ -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
|
||||
|
||||
|
@ -44,9 +44,9 @@ LOG = logging.getLogger(__name__)
|
||||
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'),
|
||||
|
@ -196,7 +196,7 @@ class CopyView(forms.ModalFormView):
|
||||
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()
|
||||
|
@ -27,7 +27,7 @@ from horizon.utils import filters
|
||||
|
||||
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__)
|
||||
|
@ -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)
|
||||
|
@ -42,10 +42,10 @@ class ImagesAndSnapshotsTests(test.TestCase):
|
||||
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 @@ class ImagesAndSnapshotsTests(test.TestCase):
|
||||
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 @@ class ImagesAndSnapshotsTests(test.TestCase):
|
||||
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 @@ class ImagesAndSnapshotsTests(test.TestCase):
|
||||
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)) \
|
||||
|
@ -210,7 +210,7 @@ class DetailView(tabs.TabView):
|
||||
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,
|
||||
|
@ -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,
|
||||
|
@ -95,7 +95,7 @@ class SubnetsTable(tables.DataTable):
|
||||
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
|
||||
|
@ -138,7 +138,7 @@ class DetailView(tables.MultiTableView):
|
||||
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
|
||||
|
@ -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)
|
||||
|
@ -207,8 +207,8 @@ class TestCase(horizon_helpers.TestCase):
|
||||
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
|
||||
|
@ -38,66 +38,66 @@ SERVICE_CATALOG = [
|
||||
"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 @@ SERVICE_CATALOG = [
|
||||
"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
|
||||
}
|
||||
}
|
||||
|
3
tox.ini
3
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user