Added rest functionality to the v2 apis

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

Change-Id: Ifafcbe09d65de2f31aa5f2cbfbfd76da5bf0f05a
This commit is contained in:
digambar 2014-09-09 23:07:51 +05:30 committed by Davanum Srinivas (dims)
parent b49297b831
commit 227e1dd272

View File

@ -1,22 +1,6 @@
from pecan import expose, redirect
from webob.exc import status_map
from api.controllers import v2
class RootController(object):
@expose(generic=True, template='index.html')
def index(self):
return dict()
@index.when(method='POST')
def index_post(self, q):
redirect('http://pecan.readthedocs.org/en/latest/search.html?q=%s' % q)
@expose('error.html')
def error(self, status):
try:
status = int(status)
except ValueError: # pragma: no cover
status = 500
message = getattr(status_map.get(status), 'explanation', '')
return dict(status=status, message=message)
v2 = v2.VersionController()