Remove 204-NoContent, Flask, and Werkzeug no longer provide

public apis to add additional error code exception handling.
This commit is contained in:
Mike Terzo
2017-03-20 19:02:00 -04:00
parent 796e2ee7fd
commit cdedf94506
3 changed files with 0 additions and 41 deletions

View File

@@ -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()