From e404e944adc7204868bd388d21975f891907ff5b Mon Sep 17 00:00:00 2001 From: digambar Date: Tue, 16 Sep 2014 23:23:01 +0530 Subject: [PATCH] adding wsme support to pecan Co-Authored-By: Digambar Patil Co-Authored-By: Steven Dake Change-Id: I2b663f6da3f9df6587d60f7c822d472553fc7c69 --- containers/api/controllers/v2.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/containers/api/controllers/v2.py b/containers/api/controllers/v2.py index 27daefac34..a979a7e449 100644 --- a/containers/api/controllers/v2.py +++ b/containers/api/controllers/v2.py @@ -1,29 +1,26 @@ import pecan +import wsme +from wsme import types as wtypes +import wsmeext.pecan as weme_pecan from pecan import rest, response class ContainerController(rest.RestController): - @pecan.expose("json") + @weme_pecan.wsexpose(Container) def get(self): #TODO: Returns all the containers return { "200": "It returns all the containers." } - @pecan.expose() + @wsme_pecan.wsexpose(Container, body=Container, status_code=201) def post(self): # TODO: Create a new container response.status = 201 return - @pecan.expose() - def put(self): - # TODO: Edit the containers values (return 200 or 204) - response.status = 204 - return - - @pecan.expose() + @wsme_pecan.wsexpose(None, status_code=204) def delete(self): # TODO: DELETE the containers response.status = 200