Return empty dict in controller(Urgent)

1. What is the problem?
After updated to version 1.2, the WSGI framework we use, pecan has a
behaviour that if the handle function return None, the setting of
resonse status code will not take effect. In the deletion handle
functions of pod and pod-binding controllers, we set the response
status code but return None, thus the status code is not changed and
our tests fail.

2. What is the solution to the problem?
Return an empty dict in the deletion handle functions.

3. What the features need to be implemented to the Tricircle to realize
the solution?
No new features.

Change-Id: I4bc44d2bc774fbe0cd9f820361d35077c83f3973
This commit is contained in:
zhiyuan_cai 2016-09-23 10:28:25 +08:00
parent 9d9c69ee48
commit 85df9c9c5f
1 changed files with 2 additions and 0 deletions

View File

@ -175,6 +175,7 @@ class PodsController(rest.RestController):
az_ag.delete_ag(context, ag['id'])
core.delete_resource(context, models.Pod, _id)
pecan.response.status = 200
return {}
except t_exc.ResourceNotFound:
return Response(_('Pod not found'), 404)
except Exception as e:
@ -317,6 +318,7 @@ class BindingsController(rest.RestController):
with context.session.begin():
core.delete_resource(context, models.PodBinding, _id)
pecan.response.status = 200
return {}
except t_exc.ResourceNotFound:
pecan.abort(404, _('Pod binding not found'))
return