Merge "Putting context as the first parameter"

This commit is contained in:
Zuul 2018-06-20 07:41:08 +00:00 committed by Gerrit Code Review
commit fb0dcf1a18
2 changed files with 10 additions and 10 deletions

View File

@ -70,7 +70,7 @@ class ContainerCollection(collection.Collection):
context = pecan.request.context context = pecan.request.context
collection = ContainerCollection() collection = ContainerCollection()
collection.containers = \ collection.containers = \
[view.format_container(url, p, context) for p in rpc_containers] [view.format_container(context, url, p) for p in rpc_containers]
collection.next = collection.get_next(limit, url=url, **kwargs) collection.next = collection.get_next(limit, url=url, **kwargs)
return collection return collection
@ -259,8 +259,8 @@ class ContainersController(base.Controller):
except exception.ContainerHostNotUp: except exception.ContainerHostNotUp:
raise exception.ServerNotUsable raise exception.ServerNotUsable
return view.format_container(pecan.request.host_url, container, return view.format_container(context, pecan.request.host_url,
context) container)
def _generate_name_for_container(self): def _generate_name_for_container(self):
"""Generate a random name like: zeta-22-container.""" """Generate a random name like: zeta-22-container."""
@ -369,8 +369,8 @@ class ContainersController(base.Controller):
pecan.response.location = link.build_url('containers', pecan.response.location = link.build_url('containers',
new_container.uuid) new_container.uuid)
pecan.response.status = 202 pecan.response.status = 202
return view.format_container(pecan.request.host_url, new_container, return view.format_container(context, pecan.request.host_url,
context) new_container)
def _set_default_resource_limit(self, container_dict): def _set_default_resource_limit(self, container_dict):
# NOTE(kiennt): Default disk size will be set later. # NOTE(kiennt): Default disk size will be set later.
@ -573,8 +573,8 @@ class ContainersController(base.Controller):
context = pecan.request.context context = pecan.request.context
compute_api = pecan.request.compute_api compute_api = pecan.request.compute_api
container = compute_api.container_update(context, container, patch) container = compute_api.container_update(context, container, patch)
return view.format_container(pecan.request.host_url, container, return view.format_container(context, pecan.request.host_url,
context) container)
@base.Controller.api_version("1.1", "1.13") @base.Controller.api_version("1.1", "1.13")
@pecan.expose('json') @pecan.expose('json')
@ -594,8 +594,8 @@ class ContainersController(base.Controller):
container.name = name container.name = name
context = pecan.request.context context = pecan.request.context
container.save(context) container.save(context)
return view.format_container(pecan.request.host_url, container, return view.format_container(context, pecan.request.host_url,
context) container)
@pecan.expose('json') @pecan.expose('json')
@exception.wrap_pecan_controller_exception @exception.wrap_pecan_controller_exception

View File

@ -50,7 +50,7 @@ _basic_keys = (
) )
def format_container(url, container, context): def format_container(context, url, container):
def transform(key, value): def transform(key, value):
if key not in _basic_keys: if key not in _basic_keys:
return return