From c2058c6bd55eb39ec8edffaa89c89babbc6cc434 Mon Sep 17 00:00:00 2001 From: Sanj Date: Thu, 6 Oct 2011 00:31:49 +0530 Subject: [PATCH] sanity check --- trubox/deals/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trubox/deals/views.py b/trubox/deals/views.py index 858e318..895fd8f 100755 --- a/trubox/deals/views.py +++ b/trubox/deals/views.py @@ -8,7 +8,9 @@ def index(request): return render_to_response("home.html", {}) def search(request): - q = request.GET.get("q") + q = request.GET.get("q", "") + if q == '': + return render_to_json_response({'error': 'empty search'}) bing = bingapi.Bing(LIVE_APP_ID) results = bing.do_image_search(q) images = results['SearchResponse']['Image']['Results']