Remove 204-NoContent, Flask, and Werkzeug no longer provide
public apis to add additional error code exception handling.
This commit is contained in:
@@ -17,7 +17,6 @@ from flask import (
|
||||
)
|
||||
|
||||
from pypuppetdb import connect
|
||||
from pypuppetdb.errors import EmptyResponseError
|
||||
from pypuppetdb.QueryBuilder import *
|
||||
|
||||
from puppetboard.forms import (CatalogForm, QueryForm)
|
||||
@@ -119,26 +118,6 @@ def utility_processor():
|
||||
return dict(now=now)
|
||||
|
||||
|
||||
#
|
||||
# 204 doesn't have a mapping in werkzeug, we need to define a custom
|
||||
# class and then set it to the mappings.
|
||||
#
|
||||
class NoContent(ex.HTTPException):
|
||||
code = 204
|
||||
description = '<p>No content</p'
|
||||
|
||||
abort.mapping[204] = NoContent
|
||||
|
||||
try:
|
||||
@app.errorhandler(204)
|
||||
def no_content(e):
|
||||
return '', 204
|
||||
except KeyError:
|
||||
@app.errorhandler(EmptyResponseError)
|
||||
def no_content(e):
|
||||
return '', 204
|
||||
|
||||
|
||||
@app.errorhandler(400)
|
||||
def bad_request(e):
|
||||
envs = environments()
|
||||
|
||||
Reference in New Issue
Block a user