Fix E128 errors in horizon/
E128 continuation line under-indented for visual indent Partial-Bug: #1375929 Change-Id: If4cc09995a74b68a6b037ea8999cebe09c750e65
This commit is contained in:
parent
9d846d19f6
commit
5dfca25190
@ -510,13 +510,15 @@ class Dashboard(Registry, HorizonComponent):
|
||||
continue
|
||||
url_slug = panel.slug.replace('.', '/')
|
||||
urlpatterns += patterns('',
|
||||
url(r'^%s/' % url_slug, include(panel._decorated_urls)))
|
||||
url(r'^%s/' % url_slug,
|
||||
include(panel._decorated_urls)))
|
||||
# Now the default view, which should come last
|
||||
if not default_panel:
|
||||
raise NotRegistered('The default panel "%s" is not registered.'
|
||||
% self.default_panel)
|
||||
urlpatterns += patterns('',
|
||||
url(r'', include(default_panel._decorated_urls)))
|
||||
url(r'',
|
||||
include(default_panel._decorated_urls)))
|
||||
|
||||
# Require login if not public.
|
||||
if not self.public:
|
||||
@ -835,7 +837,8 @@ class Site(Registry, HorizonComponent):
|
||||
# Compile the dynamic urlconf.
|
||||
for dash in self._registry.values():
|
||||
urlpatterns += patterns('',
|
||||
url(r'^%s/' % dash.slug, include(dash._decorated_urls)))
|
||||
url(r'^%s/' % dash.slug,
|
||||
include(dash._decorated_urls)))
|
||||
|
||||
# Return the three arguments to django.conf.urls.include
|
||||
return urlpatterns, self.namespace, self.slug
|
||||
|
@ -173,7 +173,7 @@ class SelectWidget(widgets.Select):
|
||||
])
|
||||
"""
|
||||
def __init__(self, attrs=None, choices=(), data_attrs=(), transform=None,
|
||||
transform_html_attrs=None):
|
||||
transform_html_attrs=None):
|
||||
self.data_attrs = data_attrs
|
||||
self.transform = transform
|
||||
self.transform_html_attrs = transform_html_attrs
|
||||
|
@ -24,12 +24,14 @@ from django.views.generic import TemplateView # noqa
|
||||
|
||||
from horizon.test.jasmine import jasmine
|
||||
|
||||
urlpatterns = patterns('horizon.views',
|
||||
urlpatterns = patterns(
|
||||
'horizon.views',
|
||||
url(r'^home/$', 'user_home', name='user_home')
|
||||
)
|
||||
|
||||
# Client-side i18n URLconf.
|
||||
urlpatterns += patterns('',
|
||||
urlpatterns += patterns(
|
||||
'',
|
||||
url(r'^i18n/js/(?P<packages>\S+?)/$',
|
||||
'django.views.i18n.javascript_catalog',
|
||||
name='jsi18n'),
|
||||
@ -40,7 +42,8 @@ urlpatterns += patterns('',
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
urlpatterns += patterns('',
|
||||
urlpatterns += patterns(
|
||||
'',
|
||||
url(r'^qunit/$',
|
||||
TemplateView.as_view(template_name="horizon/qunit.html"),
|
||||
name='qunit_tests'),
|
||||
|
@ -263,7 +263,7 @@ class Action(BaseAction):
|
||||
self.requires_input = kwargs.get('requires_input', True)
|
||||
self.verbose_name = kwargs.get('verbose_name', self.name.title())
|
||||
self.verbose_name_plural = kwargs.get('verbose_name_plural',
|
||||
"%ss" % self.verbose_name)
|
||||
"%ss" % self.verbose_name)
|
||||
self.allowed_data_types = kwargs.get('allowed_data_types', [])
|
||||
self.icon = kwargs.get('icon', None)
|
||||
|
||||
@ -465,7 +465,8 @@ class FilterAction(BaseAction):
|
||||
self.icon = "search"
|
||||
|
||||
if self.filter_type == 'server' and self.filter_choices is None:
|
||||
raise NotImplementedError('A FilterAction object with the '
|
||||
raise NotImplementedError(
|
||||
'A FilterAction object with the '
|
||||
'filter_type attribute set to "server" must also have a '
|
||||
'filter_choices attribute.')
|
||||
|
||||
@ -686,7 +687,8 @@ class BatchAction(Action):
|
||||
self.success_url = kwargs.get('success_url', None)
|
||||
# If setting a default name, don't initialize it too early
|
||||
self.verbose_name = kwargs.get('verbose_name', self._get_action_name)
|
||||
self.verbose_name_plural = kwargs.get('verbose_name_plural',
|
||||
self.verbose_name_plural = kwargs.get(
|
||||
'verbose_name_plural',
|
||||
lambda: self._get_action_name('plural'))
|
||||
|
||||
self.current_present_action = 0
|
||||
|
@ -992,8 +992,8 @@ class DataTableOptions(object):
|
||||
'context_var_name',
|
||||
'table'))
|
||||
self.actions_column = getattr(options,
|
||||
'actions_column',
|
||||
len(self.row_actions) > 0)
|
||||
'actions_column',
|
||||
len(self.row_actions) > 0)
|
||||
self.multi_select = getattr(options,
|
||||
'multi_select',
|
||||
len(self.table_actions) > 0)
|
||||
@ -1186,13 +1186,11 @@ class DataTable(object):
|
||||
if valid_method or needs_preloading:
|
||||
filter_field = self.get_filter_field()
|
||||
if self._meta.mixed_data_type:
|
||||
self._filtered_data = action.data_type_filter(self,
|
||||
self.data,
|
||||
filter_string)
|
||||
self._filtered_data = action.data_type_filter(
|
||||
self, self.data, filter_string)
|
||||
elif not action.is_api_filter(filter_field):
|
||||
self._filtered_data = action.filter(self,
|
||||
self.data,
|
||||
filter_string)
|
||||
self._filtered_data = action.filter(
|
||||
self, self.data, filter_string)
|
||||
return self._filtered_data
|
||||
|
||||
def slugify_name(self):
|
||||
@ -1298,7 +1296,7 @@ class DataTable(object):
|
||||
matches.append(datum)
|
||||
if len(matches) > 1:
|
||||
raise ValueError("Multiple matches were returned for that id: %s."
|
||||
% matches)
|
||||
% matches)
|
||||
if not matches:
|
||||
raise exceptions.Http302(self.get_absolute_url(),
|
||||
_('No match returned for the id "%s".')
|
||||
@ -1609,7 +1607,7 @@ class DataTable(object):
|
||||
table_name, action_name, obj_id = self.check_handler(request)
|
||||
if table_name == self.name and action_name:
|
||||
action_names = [action.name for action in
|
||||
self.base_actions.values() if not action.preempt]
|
||||
self.base_actions.values() if not action.preempt]
|
||||
# do not run preemptive actions here
|
||||
if action_name in action_names:
|
||||
return self.take_action(action_name, obj_id)
|
||||
|
@ -38,7 +38,7 @@ class FormsetCell(horizon_tables.Cell):
|
||||
else:
|
||||
if self.field.errors:
|
||||
self.attrs['class'] = (self.attrs.get('class', '') +
|
||||
' error form-group')
|
||||
' error form-group')
|
||||
self.attrs['title'] = ' '.join(
|
||||
unicode(error) for error in self.field.errors)
|
||||
|
||||
@ -64,7 +64,7 @@ class FormsetRow(horizon_tables.Row):
|
||||
|
||||
def render(self):
|
||||
return loader.render_to_string(self.template_path,
|
||||
{"row": self, "form": self.form})
|
||||
{"row": self, "form": self.form})
|
||||
|
||||
|
||||
class FormsetDataTableMixin(object):
|
||||
|
@ -35,7 +35,7 @@ class ParseDateNode(template.Node):
|
||||
datetime.
|
||||
"""
|
||||
formats = ["%Y-%m-%dT%H:%M:%S.%f", "%Y-%m-%d %H:%M:%S.%f",
|
||||
"%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S"]
|
||||
"%Y-%m-%dT%H:%M:%S", "%Y-%m-%d %H:%M:%S"]
|
||||
if datestring:
|
||||
for format in formats:
|
||||
try:
|
||||
|
@ -22,9 +22,9 @@ register = base.Library()
|
||||
def shellfilter(value):
|
||||
"""Replace HTML chars for shell usage."""
|
||||
replacements = {'\\': '\\\\',
|
||||
'`': '\`',
|
||||
"'": "\\'",
|
||||
'"': '\\"'}
|
||||
'`': '\`',
|
||||
"'": "\\'",
|
||||
'"': '\\"'}
|
||||
for search, repl in replacements.items():
|
||||
value = value.replace(search, repl)
|
||||
return safestring.mark_safe(value)
|
||||
|
@ -47,12 +47,12 @@ def filesizeformat(bytes, filesize_number_format):
|
||||
bytes = float(bytes)
|
||||
except (TypeError, ValueError, UnicodeDecodeError):
|
||||
return ungettext_lazy("%(size)d Byte",
|
||||
"%(size)d Bytes", 0) % {'size': 0}
|
||||
"%(size)d Bytes", 0) % {'size': 0}
|
||||
|
||||
if bytes < 1024:
|
||||
bytes = int(bytes)
|
||||
return ungettext_lazy("%(size)d Byte",
|
||||
"%(size)d Bytes", bytes) % {'size': bytes}
|
||||
"%(size)d Bytes", bytes) % {'size': bytes}
|
||||
if bytes < 1024 * 1024:
|
||||
return _("%s KB") % \
|
||||
filesize_number_format(bytes / 1024)
|
||||
|
@ -195,12 +195,14 @@ STATICFILES_DIRS = [
|
||||
|
||||
if xstatic.main.XStatic(xstatic.pkg.jquery_ui).version.startswith('1.10.'):
|
||||
# The 1.10.x versions already contain the 'ui' directory.
|
||||
STATICFILES_DIRS.append(('horizon/lib/jquery-ui',
|
||||
xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
|
||||
STATICFILES_DIRS.append(
|
||||
('horizon/lib/jquery-ui',
|
||||
xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
|
||||
else:
|
||||
# Newer versions dropped the directory, add it to keep the path the same.
|
||||
STATICFILES_DIRS.append(('horizon/lib/jquery-ui/ui',
|
||||
xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
|
||||
STATICFILES_DIRS.append(
|
||||
('horizon/lib/jquery-ui/ui',
|
||||
xstatic.main.XStatic(xstatic.pkg.jquery_ui).base_dir))
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
|
@ -1,8 +1,21 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon.test.test_dashboards.cats.kittens.views import IndexView # noqa
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', IndexView.as_view(), name='index'),
|
||||
)
|
||||
|
@ -1,8 +1,21 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon.test.test_dashboards.cats.tigers.views import IndexView # noqa
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', IndexView.as_view(), name='index'),
|
||||
)
|
||||
|
@ -1,10 +1,23 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
from horizon.test.test_dashboards.dogs.puppies.views import IndexView # noqa
|
||||
from horizon.test.test_dashboards.dogs.puppies.views import TwoTabsView # noqa
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', IndexView.as_view(), name='index'),
|
||||
url(r'^tabs/$', TwoTabsView.as_view(), name='tabs'),
|
||||
)
|
||||
|
@ -30,7 +30,8 @@ class FormMixinTests(test.TestCase):
|
||||
return view
|
||||
|
||||
def test_modal_form_mixin_hide_true_if_ajax(self):
|
||||
view = self._prepare_view(forms.views.ModalFormView,
|
||||
view = self._prepare_view(
|
||||
forms.views.ModalFormView,
|
||||
dict(HTTP_X_REQUESTED_WITH='XMLHttpRequest'))
|
||||
context = view.get_context_data()
|
||||
self.assertTrue(context['hide'])
|
||||
@ -55,7 +56,8 @@ class FormMixinTests(test.TestCase):
|
||||
self.assertNotIn('add_to_field', context)
|
||||
|
||||
def test_template_name_change_based_on_ajax_request(self):
|
||||
view = self._prepare_view(forms.views.ModalFormView,
|
||||
view = self._prepare_view(
|
||||
forms.views.ModalFormView,
|
||||
dict(HTTP_X_REQUESTED_WITH='XMLHttpRequest'))
|
||||
self.assertEqual('_' + view.template_name,
|
||||
view.get_template_names())
|
||||
@ -105,20 +107,21 @@ class TestChoiceFieldForm(forms.SelfHandlingForm):
|
||||
"label2": {"title": "This is choice 2"},
|
||||
"label3": {"title": "This is choice 3"}}
|
||||
name = forms.CharField(max_length=255,
|
||||
label="Test Name",
|
||||
help_text="Please enter a name")
|
||||
label="Test Name",
|
||||
help_text="Please enter a name")
|
||||
test_choices = forms.ChoiceField(label="Test Choices",
|
||||
required=False,
|
||||
help_text="Testing drop down choices",
|
||||
widget=forms.fields.SelectWidget(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'},
|
||||
transform_html_attrs=title_dic.get))
|
||||
required=False,
|
||||
help_text="Testing drop down choices",
|
||||
widget=forms.fields.SelectWidget(
|
||||
attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'},
|
||||
transform_html_attrs=title_dic.get))
|
||||
|
||||
def __init__(self, request, *args, **kwargs):
|
||||
super(TestChoiceFieldForm, self).__init__(request, *args, **kwargs)
|
||||
choices = ([('choice1', 'label1'),
|
||||
('choice2', 'label2')])
|
||||
('choice2', 'label2')])
|
||||
self.fields['test_choices'].choices = choices
|
||||
|
||||
def handle(self, request, data):
|
||||
@ -139,7 +142,11 @@ class ChoiceFieldTests(test.TestCase):
|
||||
|
||||
def test_choicefield_title(self):
|
||||
resp = self._render_form()
|
||||
self.assertContains(resp, '<option value="choice1" '
|
||||
'title="This is choice 1">label1</option>', count=1, html=True)
|
||||
self.assertContains(resp, '<option value="choice2" '
|
||||
'title="This is choice 2">label2</option>', count=1, html=True)
|
||||
self.assertContains(
|
||||
resp,
|
||||
'<option value="choice1" title="This is choice 1">label1</option>',
|
||||
count=1, html=True)
|
||||
self.assertContains(
|
||||
resp,
|
||||
'<option value="choice2" title="This is choice 2">label2</option>',
|
||||
count=1, html=True)
|
||||
|
@ -209,7 +209,7 @@ class MyTable(tables.DataTable):
|
||||
tooltip_dict = {'up': {'title': 'service is up and running',
|
||||
'style': 'color:green;cursor:pointer'},
|
||||
'down': {'title': 'service is not available',
|
||||
'style': 'color:red;cursor:pointer'}}
|
||||
'style': 'color:red;cursor:pointer'}}
|
||||
id = tables.Column('id', hidden=True, sortable=False)
|
||||
name = tables.Column(get_name,
|
||||
verbose_name="Verbose Name",
|
||||
|
@ -53,7 +53,7 @@ class TemplateTagTests(test.TestCase):
|
||||
"""Test if site_branding tag renders the correct setting."""
|
||||
rendered_str = self.render_template_tag("site_branding", "branding")
|
||||
self.assertEqual(settings.SITE_BRANDING, rendered_str.strip(),
|
||||
"tag site_branding renders %s" % rendered_str.strip())
|
||||
"tag site_branding renders %s" % rendered_str.strip())
|
||||
|
||||
def test_size_format_filters(self):
|
||||
size_str = ('5|diskgbformat', '10|diskgbformat',
|
||||
|
@ -119,33 +119,33 @@ class ValidatorsTests(test.TestCase):
|
||||
|
||||
def test_validate_IPs(self):
|
||||
GOOD_IPS_V4 = ("0.0.0.0",
|
||||
"10.144.11.107",
|
||||
"169.144.11.107",
|
||||
"172.100.11.107",
|
||||
"255.255.255.255",
|
||||
"0.1.2.3")
|
||||
"10.144.11.107",
|
||||
"169.144.11.107",
|
||||
"172.100.11.107",
|
||||
"255.255.255.255",
|
||||
"0.1.2.3")
|
||||
GOOD_IPS_V6 = ("",
|
||||
"::ffff:0:0",
|
||||
"2001:0db8::1428:57ab",
|
||||
"FEC0::",
|
||||
"fe80::204:61ff:254.157.241.86",
|
||||
"fe80::204:61ff:254.157.241.86",
|
||||
"2001:0DB8::CD30:0:0:0:0")
|
||||
"::ffff:0:0",
|
||||
"2001:0db8::1428:57ab",
|
||||
"FEC0::",
|
||||
"fe80::204:61ff:254.157.241.86",
|
||||
"fe80::204:61ff:254.157.241.86",
|
||||
"2001:0DB8::CD30:0:0:0:0")
|
||||
BAD_IPS_V4 = ("1111:2222:3333:4444:::",
|
||||
"::2222:3333:4444:5555:6666:7777:8888:",
|
||||
":1111:2222:3333:4444::6666:1.2.3.4",
|
||||
"1111:2222::4444:5555:6666::8888",
|
||||
"1111:2222::4444:5555:6666:8888/",
|
||||
"1111:2222::4444:5555:6666::8888/130",
|
||||
"127.0.0.1/",
|
||||
"127.0.0.1/33",
|
||||
"127.0.0.1/-1")
|
||||
"::2222:3333:4444:5555:6666:7777:8888:",
|
||||
":1111:2222:3333:4444::6666:1.2.3.4",
|
||||
"1111:2222::4444:5555:6666::8888",
|
||||
"1111:2222::4444:5555:6666:8888/",
|
||||
"1111:2222::4444:5555:6666::8888/130",
|
||||
"127.0.0.1/",
|
||||
"127.0.0.1/33",
|
||||
"127.0.0.1/-1")
|
||||
BAD_IPS_V6 = ("1111:2222:3333:4444:::",
|
||||
"::2222:3333:4444:5555:6666:7777:8888:",
|
||||
":1111:2222:3333:4444::6666:1.2.3.4",
|
||||
"1111:2222::4444:5555:6666::8888",
|
||||
"1111:2222::4444:5555:6666:8888/",
|
||||
"1111:2222::4444:5555:6666::8888/130")
|
||||
"::2222:3333:4444:5555:6666:7777:8888:",
|
||||
":1111:2222:3333:4444::6666:1.2.3.4",
|
||||
"1111:2222::4444:5555:6666::8888",
|
||||
"1111:2222::4444:5555:6666:8888/",
|
||||
"1111:2222::4444:5555:6666::8888/130")
|
||||
ipv4 = forms.IPField(required=True, version=forms.IPv4)
|
||||
ipv6 = forms.IPField(required=False, version=forms.IPv6)
|
||||
ipmixed = forms.IPField(required=False,
|
||||
|
@ -88,8 +88,9 @@ class TestStepTwo(workflows.Step):
|
||||
action_class = TestActionTwo
|
||||
depends_on = ("project_id",)
|
||||
contributes = ("instance_id",)
|
||||
connections = {"project_id": (local_callback_func,
|
||||
"horizon.test.tests.workflows.other_callback_func")}
|
||||
connections = {"project_id":
|
||||
(local_callback_func,
|
||||
"horizon.test.tests.workflows.other_callback_func")}
|
||||
|
||||
|
||||
class TestExtraStep(workflows.Step):
|
||||
|
@ -30,7 +30,8 @@ import horizon
|
||||
from horizon.test.jasmine import jasmine
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'', include(horizon.urls)),
|
||||
url(r"auth/login/", "django.contrib.auth.views.login",
|
||||
{'template_name': "auth/login.html"},
|
||||
|
@ -673,7 +673,7 @@ class Workflow(html.HTMLElement):
|
||||
self._ordered_steps = [self._registry[step_class]
|
||||
for step_class in ordered_step_classes
|
||||
if has_permissions(self.request.user,
|
||||
self._registry[step_class])]
|
||||
self._registry[step_class])]
|
||||
|
||||
def _order_steps(self):
|
||||
steps = list(copy.copy(self.default_steps))
|
||||
|
Loading…
Reference in New Issue
Block a user