def loadElectionData(year): with ca.open_resource('static/election-data/{}/election-stats.json'.format(year)) as f: js = json.load(f) current_app.current_election_json = Election.addData(js) e = Election(**js) return e