maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH maposmatic 2/2] FIXED bug with IE: force javastc


From: David Decotigny
Subject: [Maposmatic-dev] [PATCH maposmatic 2/2] FIXED bug with IE: force javastcript to encode the nominatim query arguments
Date: Tue, 22 Dec 2009 19:23:17 +0100

When the city query contains special features (accents, etc.), IE was
getting the nominatim query URL without escaping them. This patch adds
the ability for the nominatim pages to be queried through GET. We then
ask jQuery to pass the query arguments through GET, which has the nice
consequence that everything is escaped correctly.
---
 www/maposmatic/views.py             |    7 +++++--
 www/templates/maposmatic/index.html |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index 4f633e6..afc49bc 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -234,12 +234,15 @@ def all_maps(request):
 
 def query_nominatim(request, format, squery):
     if not format:
-        format = "json"
+        format = request.GET.get("format", "json")
     else:
         format = format[:-1]
 
     if format not in ("json",):
-        return HttpResponseBadRequest("Invalid format: %s" % format)
+        return HttpResponseBadRequest("ERROR: Invalid format")
+
+    if not squery:
+        squery = request.GET.get("q")
 
     try:
         contents = nominatim.query(squery, with_polygons=False)
diff --git a/www/templates/maposmatic/index.html 
b/www/templates/maposmatic/index.html
index 3a0f268..306e97f 100644
--- a/www/templates/maposmatic/index.html
+++ b/www/templates/maposmatic/index.html
@@ -175,7 +175,7 @@ function validate_city_search()
   elemFound = 0;
   unusableToken = 0;
 
-  $.getJSON("/nominatim/" + searchPat,
+  $.getJSON("/nominatim", {'q': searchPat},
             function(data){
               $("#result_nominatim_search").empty();
 
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]