Permalink
Browse files

fix bug when not searching and list based on ip

  • Loading branch information...
1 parent 32d4e8e commit c7c3c8c81582443198d6af853d767f76c74e3556 @andrewsmedina andrewsmedina committed Aug 14, 2010
Showing with 5 additions and 7 deletions.
  1. +3 −3 wifimap/spots/tests/test_search.py
  2. +2 −4 wifimap/spots/views.py
@@ -20,15 +20,15 @@ def add_some_points(self):
self.point2 = AccessPoint.objects.create(name='point 2', address='Porto Alegre, Brazil', lat=24, lng=24)
def test_view_exists(self):
- response = self.client.get(self.url)
+ response = self.client.get(self.url, {'place':'Rio de Janeiro, Brazil'})
assert 200 == response.status_code
def test_search_return_a_json(self):
- response = self.client.get(self.url)
+ response = self.client.get(self.url, {'place':'Rio de Janeiro, Brazil'})
assert response.items()[0][1] == 'application/json'
def test_search_returns_all_points(self):
- response = self.client.get(self.url)
+ response = self.client.get(self.url, {'place':'Rio de Janeiro, Brazil'})
expected = {
'points': [
View
@@ -8,7 +8,7 @@
from spots.forms import AccessPointForm
from spots.models import AccessPoint
-from spots.lib import geocode
+from spots.lib import geocode, point_by_ip
def index(request):
return direct_to_template(request, 'index.html', extra_context={})
@@ -42,9 +42,7 @@ def search_spots(request):
points = AccessPoint.objects.all()
-
-
- if request.GET:
+ if request.GET.has_key('place'):
geo_data = geocode(request.GET['place'])
address = geo_data['Placemark'][0]['address']

0 comments on commit c7c3c8c

Please sign in to comment.