Fixed the TemplateNotFound error in v1 api.

Fixed the bug #1109217.

Change-Id: Ic4019d2bc91701127ee2b2fb555897a14bd0f299
This commit is contained in:
Lianhao Lu 2013-01-30 18:00:49 +08:00
parent 09c8251e5f
commit 3ebf760640
3 changed files with 16 additions and 8 deletions

View File

@ -91,7 +91,9 @@ from ceilometer.api.v1 import acl
LOG = log.getLogger(__name__)
blueprint = flask.Blueprint('v1', __name__)
blueprint = flask.Blueprint('v1', __name__,
template_folder='templates',
static_folder='static')
def request_wants_html():

View File

@ -4,9 +4,9 @@
<title>
Metering for {{meter}}
</title>
<link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/static/rickshaw.css" rel="stylesheet" type="text/css">
<link href="/v1/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="/v1/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<link href="/v1/static/rickshaw.css" rel="stylesheet" type="text/css">
</head>
<body>
@ -80,10 +80,10 @@
</div>
</div>
<script src="/static/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="/static/jquery-1.8.3.js" type="text/javascript"></script>
<script src="/static/d3.v2.js" type="text/javascript"></script>
<script src="/static/rickshaw.js" type="text/javascript"></script>
<script src="/v1/static/bootstrap/js/bootstrap.js" type="text/javascript"></script>
<script src="/v1/static/jquery-1.8.3.js" type="text/javascript"></script>
<script src="/v1/static/d3.v2.js" type="text/javascript"></script>
<script src="/v1/static/rickshaw.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {

View File

@ -203,3 +203,9 @@ class TestListEvents(tests_api.TestBase):
headers={"X-Roles": "Member",
"X-Tenant-Id": "project2"})
self.assertEquals(1, len(data['events']))
def test_template_list_event(self):
rv = self.get('/resources/resource-id/meters/instance',
headers={"Accept": "text/html"})
self.assertEqual(200, rv.status_code)
self.assertTrue("text/html" in rv.content_type)