From 1e164d569ba54911880cbecd2deded48a2f0a327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Mazi=C3=A8res?= Date: Thu, 30 Jan 2014 11:02:41 +0100 Subject: [PATCH] quick and dirty HN-proofing --- hello.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hello.py b/hello.py index 3cedc56..441a2a6 100644 --- a/hello.py +++ b/hello.py @@ -15,6 +15,8 @@ 'blowjob,handjob,titjob,footjob' ] +hn_proof = {} + def format_query(query): s = '' for w in query.split(',')[:10]: @@ -42,10 +44,13 @@ def get_data(query): def index(): try: q = format_query(request.args['q']) + res = get_data(q) except: q = choice(examples) + if q not in hn_proof.keys(): + hn_proof[q] = get_data(q) + res = hn_proof[q] - res = get_data(q) return render_template('index', q=q, res=res) if __name__ == "__main__":