Support for new Flask errorhandling

This commit is contained in:
Mike Terzo
2017-02-01 18:36:51 -05:00
parent 58d613ba02
commit 596f0110f1

View File

@@ -17,6 +17,7 @@ from flask import (
)
from pypuppetdb import connect
from pypuppetdb.errors import EmptyResponseError
from pypuppetdb.QueryBuilder import *
from puppetboard.forms import (CatalogForm, QueryForm)
@@ -115,9 +116,13 @@ class NoContent(ex.HTTPException):
abort.mapping[204] = NoContent
@app.errorhandler(204)
def no_content(e):
try:
@app.errorhandler(204)
def no_content(e):
return '', 204
except KeyError:
@app.errorhandler(EmptyResponseError)
def no_content(e):
return '', 204