Skip to content
Snippets Groups Projects
Verified Commit c3f694d9 authored by Owen Graham's avatar Owen Graham
Browse files

Factor out assignments to `g`

parent 668ac649
Branches
No related tags found
No related merge requests found
......@@ -90,19 +90,19 @@ matplotlib.use('Agg')
@app.route('/')
def home():
g.stations = read_stations()
populate_g()
return render_template('index.html')
@app.route('/overlay')
def overlay():
g.stations = read_stations()
populate_g()
return render_template('overlay.html')
@app.route('/boxplot')
def boxplot():
g.stations = read_stations()
populate_g()
return render_template('boxplot.html')
......@@ -301,6 +301,11 @@ def savefig_response(fig):
return Response(buf.getvalue(), mimetype='image/png')
def populate_g():
"""Populate `g` with data for rendering page templates."""
g.stations = read_stations()
def read_stations():
"""Read amrdcrecords.json."""
with open('amrdcrecords.json') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment