def GET(self, occupation): if occupation != occupation.lower(): raise web.seeother('/occupation/%s' % occupation.lower()) if os.path.exists(config.cache_dir + '/occupation/' + occupation): candidates, committees = pickle.load(file(config.cache_dir + '/occupation/' + occupation)) candidates, committees = candidates[:5], committees[:5] else: candidates = candidates_by_occupation(occupation, 5) committees = committees_by_occupation(occupation, 5) return render.occupation(candidates, committees, occupation)
def GET(self, occupation): if occupation != occupation.lower(): raise web.seeother('/occupation/%s' % occupation.lower()) if os.path.exists(config.cache_dir + '/occupation/' + occupation): candidates, committees = pickle.load( file(config.cache_dir + '/occupation/' + occupation)) candidates, committees = candidates[:5], committees[:5] else: candidates = candidates_by_occupation(occupation, 5) committees = committees_by_occupation(occupation, 5) return render.occupation(candidates, committees, occupation)
def GET(self, occupation): if occupation != occupation.lower(): raise web.seeother('/occupation/%s' % occupation.lower()) candidates = candidates_by_occupation(occupation, 5) committees = committees_by_occupation(occupation, 5) return render.occupation(candidates, committees, occupation)