diff options
author | 2016-06-01 17:36:45 +0800 | |
---|---|---|
committer | 2016-06-01 13:42:01 +0000 | |
commit | 5eae42a2e355e671e7906aa6e0d3d885dfd85c4b (patch) | |
tree | e703c2ddaf31c23f8cb1135f9266dc7c6804b5bf /utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py | |
parent | 17fd1aec04ec462af81a8f5ea7b96251d2d4716e (diff) |
change the usage of tornado_swagger package
changes:
move tornado_swagger package out of tornado_swagger_ui
remove tornado_swagger_ui
modify files that import tornado_swagger
originally: opnfv_testapi.tornado_swagger_ui.tornado_swagger
to: opnfv_testapi.tornado_swagger
modify setup.cfg to delete tornado_swagger_ui prefix
JIRA: FUNCTEST-286
Change-Id: I1e8972e4fbe26ad3a5d945f3aed6783d0b666a5f
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py')
-rw-r--r-- | utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py b/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py new file mode 100644 index 000000000..8bcb9668f --- /dev/null +++ b/utils/test/result_collection_api/opnfv_testapi/tornado_swagger/handlers.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +from tornado.web import URLSpec, StaticFileHandler + +from settings import default_settings, \ + SWAGGER_API_DOCS, SWAGGER_API_LIST, SWAGGER_API_SPEC +from views import SwaggerUIHandler, SwaggerResourcesHandler, SwaggerApiHandler + +__author__ = 'serena' + + +def swagger_handlers(): + prefix = default_settings.get('swagger_prefix', '/swagger') + if prefix[-1] != '/': + prefix += '/' + + def _path(suffix): + return prefix + suffix + return [ + URLSpec( + _path(r'spec.html$'), + SwaggerUIHandler, + default_settings, + name=SWAGGER_API_DOCS), + URLSpec( + _path(r'spec.json$'), + SwaggerResourcesHandler, + default_settings, + name=SWAGGER_API_LIST), + URLSpec( + _path(r'spec$'), + SwaggerApiHandler, + default_settings, + name=SWAGGER_API_SPEC), + ( + _path(r'(.*\.(css|png|gif|js))'), + StaticFileHandler, + {'path': default_settings.get('static_path')}), + ] |