summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Motoki <amotoki@gmail.com>2018-12-02 06:11:09 +0900
committerAkihiro Motoki <amotoki@gmail.com>2019-01-16 12:56:20 +0900
commitc076db20c8650df35799d2582c40a85788f37be8 (patch)
tree76d16f375419812486d3a70aecc4e4171263ccc6
parent3143edef0131b82a1d8dea8ab82e32d0225779ee (diff)
pylint: fix len-as-condition warning
Notes
Notes (review): Code-Review+2: Ivan Kolodyazhny <e0ne@e0ne.info> Workflow+1: Ivan Kolodyazhny <e0ne@e0ne.info> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 16 Jan 2019 14:25:39 +0000 Reviewed-on: https://review.openstack.org/623658 Project: openstack/horizon Branch: refs/heads/master
-rw-r--r--.pylintrc1
-rw-r--r--horizon/base.py6
-rw-r--r--horizon/middleware/operation_log.py2
-rw-r--r--horizon/tables/base.py2
-rw-r--r--horizon/utils/babel_extract_angular.py2
-rw-r--r--horizon/workflows/base.py2
-rw-r--r--openstack_dashboard/api/base.py2
-rw-r--r--openstack_dashboard/api/keystone.py2
-rw-r--r--openstack_dashboard/api/nova.py4
-rw-r--r--openstack_dashboard/api/rest/keystone.py4
-rw-r--r--openstack_dashboard/contrib/developer/profiler/api.py2
-rw-r--r--openstack_dashboard/dashboards/admin/info/tables.py3
-rw-r--r--openstack_dashboard/dashboards/admin/networks/forms.py2
-rw-r--r--openstack_dashboard/dashboards/identity/domains/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/identity/groups/views.py3
-rw-r--r--openstack_dashboard/dashboards/identity/projects/views.py3
-rw-r--r--openstack_dashboard/dashboards/identity/projects/workflows.py2
-rw-r--r--openstack_dashboard/dashboards/identity/roles/views.py2
-rw-r--r--openstack_dashboard/dashboards/identity/users/views.py2
-rw-r--r--openstack_dashboard/dashboards/project/cgroups/forms.py4
-rw-r--r--openstack_dashboard/dashboards/project/instances/forms.py2
-rw-r--r--openstack_dashboard/dashboards/project/networks/workflows.py10
-rw-r--r--openstack_dashboard/dashboards/project/volume_groups/forms.py4
23 files changed, 32 insertions, 36 deletions
diff --git a/.pylintrc b/.pylintrc
index 5c0fe87..ebafe9b 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -48,7 +48,6 @@ disable=
48 expression-not-assigned, 48 expression-not-assigned,
49 global-statement, 49 global-statement,
50 invalid-name, 50 invalid-name,
51 len-as-condition,
52 line-too-long, 51 line-too-long,
53 misplaced-comparison-constant, 52 misplaced-comparison-constant,
54 missing-docstring, 53 missing-docstring,
diff --git a/horizon/base.py b/horizon/base.py
index 1cf641a..28ffe48 100644
--- a/horizon/base.py
+++ b/horizon/base.py
@@ -519,7 +519,7 @@ class Dashboard(Registry, HorizonComponent):
519 panel_groups.append((panel_group.slug, panel_group)) 519 panel_groups.append((panel_group.slug, panel_group))
520 520
521 # Deal with leftovers (such as add-on registrations) 521 # Deal with leftovers (such as add-on registrations)
522 if len(registered): 522 if registered:
523 slugs = [panel.slug for panel in registered.values()] 523 slugs = [panel.slug for panel in registered.values()]
524 new_group = PanelGroup(self, 524 new_group = PanelGroup(self,
525 slug="other", 525 slug="other",
@@ -769,7 +769,7 @@ class Site(Registry, HorizonComponent):
769 dashboard = self._registered(item) 769 dashboard = self._registered(item)
770 dashboards.append(dashboard) 770 dashboards.append(dashboard)
771 registered.pop(dashboard.__class__) 771 registered.pop(dashboard.__class__)
772 if len(registered): 772 if registered:
773 extra = sorted(registered.values()) 773 extra = sorted(registered.values())
774 dashboards.extend(extra) 774 dashboards.extend(extra)
775 return dashboards 775 return dashboards
@@ -785,7 +785,7 @@ class Site(Registry, HorizonComponent):
785 """ 785 """
786 if self.default_dashboard: 786 if self.default_dashboard:
787 return self._registered(self.default_dashboard) 787 return self._registered(self.default_dashboard)
788 elif len(self._registry): 788 elif self._registry:
789 return self.get_dashboards()[0] 789 return self.get_dashboards()[0]
790 else: 790 else:
791 raise NotRegistered("No dashboard modules have been registered.") 791 raise NotRegistered("No dashboard modules have been registered.")
diff --git a/horizon/middleware/operation_log.py b/horizon/middleware/operation_log.py
index 87294f4..30dde20 100644
--- a/horizon/middleware/operation_log.py
+++ b/horizon/middleware/operation_log.py
@@ -182,7 +182,7 @@ class OperationLogMiddleware(object):
182 182
183 # when a file uploaded (E.g create image) 183 # when a file uploaded (E.g create image)
184 files = request.FILES.values() 184 files = request.FILES.values()
185 if len(list(files)) > 0: 185 if list(files):
186 filenames = ', '.join( 186 filenames = ', '.join(
187 [up_file.name for up_file in files]) 187 [up_file.name for up_file in files])
188 params['file_name'] = filenames 188 params['file_name'] = filenames
diff --git a/horizon/tables/base.py b/horizon/tables/base.py
index daf6401..f38e85d 100644
--- a/horizon/tables/base.py
+++ b/horizon/tables/base.py
@@ -496,7 +496,7 @@ class Column(html.HTMLElement):
496 data = [self.get_raw_data(datum) for datum in self.table.data] 496 data = [self.get_raw_data(datum) for datum in self.table.data]
497 data = [raw_data for raw_data in data if raw_data is not None] 497 data = [raw_data for raw_data in data if raw_data is not None]
498 498
499 if len(data): 499 if data:
500 try: 500 try:
501 summation = summation_function(data) 501 summation = summation_function(data)
502 for filter_func in self.filters: 502 for filter_func in self.filters:
diff --git a/horizon/utils/babel_extract_angular.py b/horizon/utils/babel_extract_angular.py
index cdf4bd5..eb231ac 100644
--- a/horizon/utils/babel_extract_angular.py
+++ b/horizon/utils/babel_extract_angular.py
@@ -123,7 +123,7 @@ class AngularGettextHTMLParser(html_parser.HTMLParser):
123 123
124 def handle_endtag(self, tag): 124 def handle_endtag(self, tag):
125 if self.in_translate: 125 if self.in_translate:
126 if len(self.inner_tags) > 0: 126 if self.inner_tags:
127 tag = self.inner_tags.pop() 127 tag = self.inner_tags.pop()
128 self.data += "</%s>" % tag 128 self.data += "</%s>" % tag
129 return 129 return
diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py
index ae39f5e..0b20b20 100644
--- a/horizon/workflows/base.py
+++ b/horizon/workflows/base.py
@@ -905,7 +905,7 @@ class Workflow(html.HTMLElement):
905 905
906 def verify_integrity(self): 906 def verify_integrity(self):
907 provided_keys = self.contributions | set(self.context_seed.keys()) 907 provided_keys = self.contributions | set(self.context_seed.keys())
908 if len(self.depends_on - provided_keys): 908 if self.depends_on - provided_keys:
909 raise exceptions.NotAvailable( 909 raise exceptions.NotAvailable(
910 _("The current user has insufficient permission to complete " 910 _("The current user has insufficient permission to complete "
911 "the requested task.")) 911 "the requested task."))
diff --git a/openstack_dashboard/api/base.py b/openstack_dashboard/api/base.py
index e7d6706..00498fc 100644
--- a/openstack_dashboard/api/base.py
+++ b/openstack_dashboard/api/base.py
@@ -258,7 +258,7 @@ class QuotaSet(Sequence):
258 258
259 def get(self, key, default=None): 259 def get(self, key, default=None):
260 match = [quota for quota in self.items if quota.name == key] 260 match = [quota for quota in self.items if quota.name == key]
261 return match.pop() if len(match) else Quota(key, default) 261 return match.pop() if match else Quota(key, default)
262 262
263 def add(self, other): 263 def add(self, other):
264 return self.__add__(other) 264 return self.__add__(other)
diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py
index 058e1a5..0ca69cf 100644
--- a/openstack_dashboard/api/keystone.py
+++ b/openstack_dashboard/api/keystone.py
@@ -634,7 +634,7 @@ def group_list(request, domain=None, project=None, user=None, filters=None):
634 project_groups = [] 634 project_groups = []
635 for group in groups: 635 for group in groups:
636 roles = roles_for_group(request, group=group.id, project=project) 636 roles = roles_for_group(request, group=group.id, project=project)
637 if roles and len(roles) > 0: 637 if roles:
638 project_groups.append(group) 638 project_groups.append(group)
639 groups = project_groups 639 groups = project_groups
640 return groups 640 return groups
diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py
index 7183234..bbea798 100644
--- a/openstack_dashboard/api/nova.py
+++ b/openstack_dashboard/api/nova.py
@@ -602,14 +602,14 @@ def server_list_paged(request,
602 servers = [Server(s, request) 602 servers = [Server(s, request)
603 for s in nova_client.servers.list(detailed, search_opts)] 603 for s in nova_client.servers.list(detailed, search_opts)]
604 if view_marker == 'possibly_deleted': 604 if view_marker == 'possibly_deleted':
605 if len(servers) == 0: 605 if not servers:
606 view_marker = 'head_deleted' 606 view_marker = 'head_deleted'
607 search_opts['sort_dir'] = 'desc' 607 search_opts['sort_dir'] = 'desc'
608 reversed_order = False 608 reversed_order = False
609 servers = [Server(s, request) 609 servers = [Server(s, request)
610 for s in nova_client.servers.list(detailed, 610 for s in nova_client.servers.list(detailed,
611 search_opts)] 611 search_opts)]
612 if len(servers) == 0: 612 if not servers:
613 view_marker = 'tail_deleted' 613 view_marker = 'tail_deleted'
614 search_opts['sort_dir'] = 'asc' 614 search_opts['sort_dir'] = 'asc'
615 reversed_order = True 615 reversed_order = True
diff --git a/openstack_dashboard/api/rest/keystone.py b/openstack_dashboard/api/rest/keystone.py
index 8575ae8..359f63d 100644
--- a/openstack_dashboard/api/rest/keystone.py
+++ b/openstack_dashboard/api/rest/keystone.py
@@ -56,7 +56,7 @@ class Users(generic.View):
56 56
57 filters = rest_utils.parse_filters_kwargs(request, 57 filters = rest_utils.parse_filters_kwargs(request,
58 self.client_keywords)[0] 58 self.client_keywords)[0]
59 if len(filters) == 0: 59 if not filters:
60 filters = None 60 filters = None
61 61
62 result = api.keystone.user_list( 62 result = api.keystone.user_list(
@@ -420,7 +420,7 @@ class Projects(generic.View):
420 420
421 filters = rest_utils.parse_filters_kwargs(request, 421 filters = rest_utils.parse_filters_kwargs(request,
422 self.client_keywords)[0] 422 self.client_keywords)[0]
423 if len(filters) == 0: 423 if not filters:
424 filters = None 424 filters = None
425 425
426 paginate = request.GET.get('paginate') == 'true' 426 paginate = request.GET.get('paginate') == 'true'
diff --git a/openstack_dashboard/contrib/developer/profiler/api.py b/openstack_dashboard/contrib/developer/profiler/api.py
index 240ca29..3d1bcdb 100644
--- a/openstack_dashboard/contrib/developer/profiler/api.py
+++ b/openstack_dashboard/contrib/developer/profiler/api.py
@@ -89,7 +89,7 @@ def list_traces(request):
89def get_trace(request, trace_id): 89def get_trace(request, trace_id):
90 def rec(_data, level=0): 90 def rec(_data, level=0):
91 _data['level'] = level 91 _data['level'] = level
92 _data['is_leaf'] = not len(_data['children']) 92 _data['is_leaf'] = not _data['children']
93 _data['visible'] = True 93 _data['visible'] = True
94 _data['childrenVisible'] = True 94 _data['childrenVisible'] = True
95 finished = _data['info']['finished'] 95 finished = _data['info']['finished']
diff --git a/openstack_dashboard/dashboards/admin/info/tables.py b/openstack_dashboard/dashboards/admin/info/tables.py
index 9e5b3ef..99a7ece 100644
--- a/openstack_dashboard/dashboards/admin/info/tables.py
+++ b/openstack_dashboard/dashboards/admin/info/tables.py
@@ -59,8 +59,7 @@ def show_endpoints(datanum):
59 if 'endpoints' in datanum: 59 if 'endpoints' in datanum:
60 template_name = 'admin/info/_cell_endpoints_v2.html' 60 template_name = 'admin/info/_cell_endpoints_v2.html'
61 context = None 61 context = None
62 if (len(datanum['endpoints']) > 0 and 62 if (datanum['endpoints'] and "publicURL" in datanum['endpoints'][0]):
63 "publicURL" in datanum['endpoints'][0]):
64 context = datanum['endpoints'][0] 63 context = datanum['endpoints'][0]
65 else: 64 else:
66 # this is a keystone v3 version of endpoints 65 # this is a keystone v3 version of endpoints
diff --git a/openstack_dashboard/dashboards/admin/networks/forms.py b/openstack_dashboard/dashboards/admin/networks/forms.py
index 0c4dd5f..3796fdc 100644
--- a/openstack_dashboard/dashboards/admin/networks/forms.py
+++ b/openstack_dashboard/dashboards/admin/networks/forms.py
@@ -238,7 +238,7 @@ class CreateNetwork(forms.SelfHandlingForm):
238 network_type_choices = [ 238 network_type_choices = [
239 (net_type, self.provider_types[net_type]['display_name']) 239 (net_type, self.provider_types[net_type]['display_name'])
240 for net_type in supported_provider_types] 240 for net_type in supported_provider_types]
241 if len(network_type_choices) == 0: 241 if not network_type_choices:
242 self._hide_provider_network_type() 242 self._hide_provider_network_type()
243 else: 243 else:
244 self.fields['network_type'].choices = network_type_choices 244 self.fields['network_type'].choices = network_type_choices
diff --git a/openstack_dashboard/dashboards/identity/domains/workflows.py b/openstack_dashboard/dashboards/identity/domains/workflows.py
index 81bf94b..8c51857 100644
--- a/openstack_dashboard/dashboards/identity/domains/workflows.py
+++ b/openstack_dashboard/dashboards/identity/domains/workflows.py
@@ -368,7 +368,7 @@ class UpdateDomain(workflows.Workflow):
368 ] 368 ]
369 admin_role_ids = [role for role in current_role_ids 369 admin_role_ids = [role for role in current_role_ids
370 if role in available_admin_role_ids] 370 if role in available_admin_role_ids]
371 if len(admin_role_ids): 371 if admin_role_ids:
372 removing_admin = any([role in current_role_ids 372 removing_admin = any([role in current_role_ids
373 for role in admin_role_ids]) 373 for role in admin_role_ids])
374 else: 374 else:
diff --git a/openstack_dashboard/dashboards/identity/groups/views.py b/openstack_dashboard/dashboards/identity/groups/views.py
index ef3df9d..ba461f8 100644
--- a/openstack_dashboard/dashboards/identity/groups/views.py
+++ b/openstack_dashboard/dashboards/identity/groups/views.py
@@ -54,8 +54,7 @@ class IndexView(tables.DataTableView):
54 # selected, then search criteria must be provided and 54 # selected, then search criteria must be provided and
55 # return an empty list 55 # return an empty list
56 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {}) 56 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
57 if filter_first.get('identity.groups', False) \ 57 if filter_first.get('identity.groups', False) and not filters:
58 and len(filters) == 0:
59 self._needs_filter_first = True 58 self._needs_filter_first = True
60 return groups 59 return groups
61 60
diff --git a/openstack_dashboard/dashboards/identity/projects/views.py b/openstack_dashboard/dashboards/identity/projects/views.py
index 74618cc..6d3e842 100644
--- a/openstack_dashboard/dashboards/identity/projects/views.py
+++ b/openstack_dashboard/dashboards/identity/projects/views.py
@@ -96,8 +96,7 @@ class IndexView(tables.DataTableView):
96 # selected, then search criteria must be provided and 96 # selected, then search criteria must be provided and
97 # return an empty list 97 # return an empty list
98 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {}) 98 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
99 if filter_first.get('identity.projects', False) and len( 99 if filter_first.get('identity.projects', False) and not filters:
100 filters) == 0:
101 self._needs_filter_first = True 100 self._needs_filter_first = True
102 self._more = False 101 self._more = False
103 return tenants 102 return tenants
diff --git a/openstack_dashboard/dashboards/identity/projects/workflows.py b/openstack_dashboard/dashboards/identity/projects/workflows.py
index 0b6e648..837d4f4 100644
--- a/openstack_dashboard/dashboards/identity/projects/workflows.py
+++ b/openstack_dashboard/dashboards/identity/projects/workflows.py
@@ -752,7 +752,7 @@ class UpdateProject(workflows.Workflow):
752 if role.name.lower() in _admin_roles] 752 if role.name.lower() in _admin_roles]
753 admin_roles = [role for role in current_role_ids 753 admin_roles = [role for role in current_role_ids
754 if role in available_admin_role_ids] 754 if role in available_admin_role_ids]
755 if len(admin_roles): 755 if admin_roles:
756 removing_admin = any([role in current_role_ids 756 removing_admin = any([role in current_role_ids
757 for role in admin_roles]) 757 for role in admin_roles])
758 else: 758 else:
diff --git a/openstack_dashboard/dashboards/identity/roles/views.py b/openstack_dashboard/dashboards/identity/roles/views.py
index eb74b83..c829dcf 100644
--- a/openstack_dashboard/dashboards/identity/roles/views.py
+++ b/openstack_dashboard/dashboards/identity/roles/views.py
@@ -52,7 +52,7 @@ class IndexView(tables.DataTableView):
52 # selected, then search criteria must be provided 52 # selected, then search criteria must be provided
53 # and return an empty list 53 # and return an empty list
54 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {}) 54 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
55 if filter_first.get('identity.roles', False) and len(filters) == 0: 55 if filter_first.get('identity.roles', False) and not filters:
56 self._needs_filter_first = True 56 self._needs_filter_first = True
57 return roles 57 return roles
58 58
diff --git a/openstack_dashboard/dashboards/identity/users/views.py b/openstack_dashboard/dashboards/identity/users/views.py
index 5764133..5199c6e 100644
--- a/openstack_dashboard/dashboards/identity/users/views.py
+++ b/openstack_dashboard/dashboards/identity/users/views.py
@@ -68,7 +68,7 @@ class IndexView(tables.DataTableView):
68 # selected, then search criteria must be provided 68 # selected, then search criteria must be provided
69 # and return an empty list 69 # and return an empty list
70 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {}) 70 filter_first = getattr(settings, 'FILTER_DATA_FIRST', {})
71 if filter_first.get('identity.users', False) and len(filters) == 0: 71 if filter_first.get('identity.users', False) and not filters:
72 self._needs_filter_first = True 72 self._needs_filter_first = True
73 return users 73 return users
74 74
diff --git a/openstack_dashboard/dashboards/project/cgroups/forms.py b/openstack_dashboard/dashboards/project/cgroups/forms.py
index 2dbd940..6712da5 100644
--- a/openstack_dashboard/dashboards/project/cgroups/forms.py
+++ b/openstack_dashboard/dashboards/project/cgroups/forms.py
@@ -149,7 +149,7 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
149 else: 149 else:
150 search_opts = {'consistentcygroup_id': data['cgroup_id']} 150 search_opts = {'consistentcygroup_id': data['cgroup_id']}
151 volumes = cinder.volume_list(request, search_opts=search_opts) 151 volumes = cinder.volume_list(request, search_opts=search_opts)
152 if len(volumes) == 0: 152 if not volumes:
153 msg = _('Unable to create snapshot. Consistency group ' 153 msg = _('Unable to create snapshot. Consistency group '
154 'must contain volumes.') 154 'must contain volumes.')
155 155
@@ -208,7 +208,7 @@ class CloneCGroupForm(forms.SelfHandlingForm):
208 208
209 search_opts = {'consistentcygroup_id': data['cgroup_id']} 209 search_opts = {'consistentcygroup_id': data['cgroup_id']}
210 volumes = cinder.volume_list(request, search_opts=search_opts) 210 volumes = cinder.volume_list(request, search_opts=search_opts)
211 if len(volumes) == 0: 211 if not volumes:
212 msg = _('Unable to clone empty consistency group.') 212 msg = _('Unable to clone empty consistency group.')
213 213
214 exceptions.handle(request, 214 exceptions.handle(request,
diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py
index f3d510a..ea5cc5f 100644
--- a/openstack_dashboard/dashboards/project/instances/forms.py
+++ b/openstack_dashboard/dashboards/project/instances/forms.py
@@ -347,7 +347,7 @@ class AttachInterface(forms.SelfHandlingForm):
347 347
348 choices = [('network', _("by Network (and IP address)"))] 348 choices = [('network', _("by Network (and IP address)"))]
349 ports = instance_utils.port_field_data(request, with_network=True) 349 ports = instance_utils.port_field_data(request, with_network=True)
350 if len(ports) > 0: 350 if ports:
351 self.fields['port'].choices = ports 351 self.fields['port'].choices = ports
352 choices.append(('port', _("by Port"))) 352 choices.append(('port', _("by Port")))
353 353
diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py
index 391d4ce..8a9683c 100644
--- a/openstack_dashboard/dashboards/project/networks/workflows.py
+++ b/openstack_dashboard/dashboards/project/networks/workflows.py
@@ -235,10 +235,10 @@ class CreateSubnetInfoAction(workflows.Action):
235 # Populate data-fields for switching the prefixlen field 235 # Populate data-fields for switching the prefixlen field
236 # when user selects a subnetpool other than 236 # when user selects a subnetpool other than
237 # "Provider default pool" 237 # "Provider default pool"
238 for (id, name) in self.fields['subnetpool'].choices: 238 for (id_, name) in self.fields['subnetpool'].choices:
239 if not len(id): 239 if not id_:
240 continue 240 continue
241 key = 'data-subnetpool-' + id 241 key = 'data-subnetpool-' + id_
242 self.fields['prefixlen'].widget.attrs[key] = \ 242 self.fields['prefixlen'].widget.attrs[key] = \
243 _('Network Mask') 243 _('Network Mask')
244 else: 244 else:
@@ -555,9 +555,9 @@ class CreateNetwork(workflows.Workflow):
555 params['gateway_ip'] = None 555 params['gateway_ip'] = None
556 elif data['gateway_ip']: 556 elif data['gateway_ip']:
557 params['gateway_ip'] = data['gateway_ip'] 557 params['gateway_ip'] = data['gateway_ip']
558 if 'subnetpool' in data and len(data['subnetpool']): 558 if 'subnetpool' in data and data['subnetpool']:
559 params['subnetpool_id'] = data['subnetpool'] 559 params['subnetpool_id'] = data['subnetpool']
560 if 'prefixlen' in data and len(data['prefixlen']): 560 if 'prefixlen' in data and data['prefixlen']:
561 params['prefixlen'] = data['prefixlen'] 561 params['prefixlen'] = data['prefixlen']
562 562
563 self._setup_subnet_parameters(params, data) 563 self._setup_subnet_parameters(params, data)
diff --git a/openstack_dashboard/dashboards/project/volume_groups/forms.py b/openstack_dashboard/dashboards/project/volume_groups/forms.py
index 312bbeb..d19a993 100644
--- a/openstack_dashboard/dashboards/project/volume_groups/forms.py
+++ b/openstack_dashboard/dashboards/project/volume_groups/forms.py
@@ -136,7 +136,7 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
136 search_opts = {'group_id': group_id} 136 search_opts = {'group_id': group_id}
137 volumes = cinder.volume_list(request, 137 volumes = cinder.volume_list(request,
138 search_opts=search_opts) 138 search_opts=search_opts)
139 if len(volumes) == 0: 139 if not volumes:
140 msg = _('Unable to create snapshot. ' 140 msg = _('Unable to create snapshot. '
141 'group must contain volumes.') 141 'group must contain volumes.')
142 142
@@ -190,7 +190,7 @@ class CloneGroupForm(forms.SelfHandlingForm):
190 190
191 search_opts = {'group_id': group_id} 191 search_opts = {'group_id': group_id}
192 volumes = cinder.volume_list(request, search_opts=search_opts) 192 volumes = cinder.volume_list(request, search_opts=search_opts)
193 if len(volumes) == 0: 193 if not volumes:
194 msg = _('Unable to clone empty group.') 194 msg = _('Unable to clone empty group.')
195 195
196 exceptions.handle(request, 196 exceptions.handle(request,