Support for new Flask errorhandling
This commit is contained in:
@@ -17,6 +17,7 @@ from flask import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from pypuppetdb import connect
|
from pypuppetdb import connect
|
||||||
|
from pypuppetdb.errors import EmptyResponseError
|
||||||
from pypuppetdb.QueryBuilder import *
|
from pypuppetdb.QueryBuilder import *
|
||||||
|
|
||||||
from puppetboard.forms import (CatalogForm, QueryForm)
|
from puppetboard.forms import (CatalogForm, QueryForm)
|
||||||
@@ -115,9 +116,13 @@ class NoContent(ex.HTTPException):
|
|||||||
|
|
||||||
abort.mapping[204] = NoContent
|
abort.mapping[204] = NoContent
|
||||||
|
|
||||||
|
try:
|
||||||
@app.errorhandler(204)
|
@app.errorhandler(204)
|
||||||
def no_content(e):
|
def no_content(e):
|
||||||
|
return '', 204
|
||||||
|
except KeyError:
|
||||||
|
@app.errorhandler(EmptyResponseError)
|
||||||
|
def no_content(e):
|
||||||
return '', 204
|
return '', 204
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user