adding wsme support to pecan

Co-Authored-By: Digambar Patil <digambarpat@gmail.com>
Co-Authored-By: Steven Dake <sdake@redhat.com>

Change-Id: I2b663f6da3f9df6587d60f7c822d472553fc7c69
This commit is contained in:
digambar 2014-09-16 23:23:01 +05:30 committed by Davanum Srinivas (dims)
parent 39500ae678
commit e404e944ad

View File

@ -1,29 +1,26 @@
import pecan import pecan
import wsme
from wsme import types as wtypes
import wsmeext.pecan as weme_pecan
from pecan import rest, response from pecan import rest, response
class ContainerController(rest.RestController): class ContainerController(rest.RestController):
@pecan.expose("json") @weme_pecan.wsexpose(Container)
def get(self): def get(self):
#TODO: Returns all the containers #TODO: Returns all the containers
return { return {
"200": "It returns all the containers." "200": "It returns all the containers."
} }
@pecan.expose() @wsme_pecan.wsexpose(Container, body=Container, status_code=201)
def post(self): def post(self):
# TODO: Create a new container # TODO: Create a new container
response.status = 201 response.status = 201
return return
@pecan.expose() @wsme_pecan.wsexpose(None, status_code=204)
def put(self):
# TODO: Edit the containers values (return 200 or 204)
response.status = 204
return
@pecan.expose()
def delete(self): def delete(self):
# TODO: DELETE the containers # TODO: DELETE the containers
response.status = 200 response.status = 200