puppetboard/app: Loading the environments in each error_processor function

In the previous commit the environment loading was moving to each request
and that functionality change was not reflected in the error processor
functions (for 4xx and 5xx series errors)
This commit is contained in:
Corey Hammerton
2015-12-14 21:26:09 -05:00
parent 26d7d43d17
commit cc9b3de2ec

View File

@@ -95,16 +95,19 @@ def utility_processor():
@app.errorhandler(400) @app.errorhandler(400)
def bad_request(e): def bad_request(e):
envs = environments()
return render_template('400.html', envs=envs), 400 return render_template('400.html', envs=envs), 400
@app.errorhandler(403) @app.errorhandler(403)
def forbidden(e): def forbidden(e):
envs = environments()
return render_template('403.html', envs=envs), 400 return render_template('403.html', envs=envs), 400
@app.errorhandler(404) @app.errorhandler(404)
def not_found(e): def not_found(e):
envs = environments()
return render_template('404.html', envs=envs), 404 return render_template('404.html', envs=envs), 404
@@ -112,11 +115,13 @@ def not_found(e):
def precond_failed(e): def precond_failed(e):
"""We're slightly abusing 412 to handle missing features """We're slightly abusing 412 to handle missing features
depending on the API version.""" depending on the API version."""
envs = environments()
return render_template('412.html', envs=envs), 412 return render_template('412.html', envs=envs), 412
@app.errorhandler(500) @app.errorhandler(500)
def server_error(e): def server_error(e):
envs = environments()
return render_template('500.html', envs=envs), 500 return render_template('500.html', envs=envs), 500