Browse Source

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
changes/89/133789/3
digambar 7 years ago
committed by Davanum Srinivas (dims)
parent
commit
227e1dd272
  1. 20
      containers/api/controllers/root.py

20
containers/api/controllers/root.py

@ -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()

Loading…
Cancel
Save