Merge "Modify the empty list ensure method"

This commit is contained in:
Zuul 2018-06-05 16:52:58 +00:00 committed by Gerrit Code Review
commit 2a1ce3a498
2 changed files with 3 additions and 3 deletions

View File

@ -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.")

View File

@ -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: