diff --git a/glance/api/v2/images.py b/glance/api/v2/images.py index 59eb317cee..3909d51399 100644 --- a/glance/api/v2/images.py +++ b/glance/api/v2/images.py @@ -228,10 +228,10 @@ class ImagesController(object): path = change['path'] path_root = path[0] value = change['value'] - if path_root == 'locations' and value == []: + if path_root == 'locations' and not value: msg = _("Cannot set locations to empty list.") raise webob.exc.HTTPForbidden(msg) - elif path_root == 'locations' and value != []: + elif path_root == 'locations' and value: self._do_replace_locations(image, value) elif path_root == 'owner' and req.context.is_admin == False: msg = _("Owner can't be updated by non admin.") diff --git a/glance/tests/unit/test_auth.py b/glance/tests/unit/test_auth.py index 56a62d4717..4807f14de7 100644 --- a/glance/tests/unit/test_auth.py +++ b/glance/tests/unit/test_auth.py @@ -72,7 +72,7 @@ class V2Token(object): service = catalog[-1] endpoint_list = [] - if region_list == []: + if not region_list: endpoint_list.append(self.base_endpoint) else: for region in region_list: