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:
parent
b49297b831
commit
227e1dd272
@ -1,22 +1,6 @@
|
|||||||
from pecan import expose, redirect
|
from pecan import expose, redirect
|
||||||
from webob.exc import status_map
|
from api.controllers import v2
|
||||||
|
|
||||||
|
|
||||||
class RootController(object):
|
class RootController(object):
|
||||||
|
v2 = v2.VersionController()
|
||||||
@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)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user