From eb9ee6965c9c8c37ddd8c8e6a6f0236a37e7f69c Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Thu, 1 Sep 2011 16:56:02 -0700 Subject: [PATCH] cleanup search_json a bit --- gazetteer/places/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py index cd6222a..c6a5d89 100644 --- a/gazetteer/places/views.py +++ b/gazetteer/places/views.py @@ -12,18 +12,18 @@ def search(request): def search_json(request): search_term = request.GET.get("q", "") - threshold = float(request.GET.get("threshold", '0.5')) + threshold = request.GET.get("threshold", '0.5') bbox = request.GET.get("bbox", False) page = int(request.GET.get("page", '1')) count = int(request.GET.get("count", '100')) - country = request.GET.get("adm0", "US") # right now, unused + country = request.GET.get("cc", "US") # right now, unused adm1 = request.GET.get("adm1", "") adm2 = request.GET.get("adm2", "") srid = int(request.GET.get("srid", 4326)) if threshold: try: - threshold = float(threshold) + threshold = max(float(threshold), 0.1) except ValueError: return render_to_json_response({'error': 'threshold must be a float'})