api: update v1 for Flask >= 0.10

Change-Id: I7e0e9a902ec57b6e5eb951d50a49629dd7cfdb7c
Fixes-Bug: #1212851
This commit is contained in:
Julien Danjou 2013-08-23 14:44:30 +02:00
parent 748c2da238
commit 706385d1e4
2 changed files with 8 additions and 6 deletions

View File

@ -18,7 +18,6 @@
"""Set up the API server application instance."""
import flask
import flask.helpers
from oslo.config import cfg
from ceilometer.api import acl
@ -26,10 +25,11 @@ from ceilometer.api.v1 import blueprint as v1_blueprint
from ceilometer.openstack.common import jsonutils
from ceilometer import storage
# Replace the json module used by flask with the one from
# openstack.common so we can take advantage of the fact that it knows
# how to serialize more complex objects.
flask.helpers.json = jsonutils
class JSONEncoder(flask.json.JSONEncoder):
@staticmethod
def default(o):
return jsonutils.to_primitive(o)
def make_app(conf, enable_acl=True, attach_storage=True,
@ -37,6 +37,8 @@ def make_app(conf, enable_acl=True, attach_storage=True,
app = flask.Flask('ceilometer.api')
app.register_blueprint(v1_blueprint.blueprint, url_prefix='/v1')
app.json_encoder = JSONEncoder
try:
with open(sources_file, "r") as f:
sources = jsonutils.load(f)

View File

@ -10,7 +10,7 @@ netaddr
pymongo>=2.4
eventlet>=0.13.0
anyjson>=0.3.3
Flask==0.9
Flask>=0.10,<1.0
pecan>=0.2.0
stevedore>=0.10
msgpack-python