Browse Source

Always restrict to at least neighborhood.

Douglas William Thrift 14 years ago
parent
commit
29fbdc4f25
2 changed files with 16 additions and 17 deletions
  1. 15 16
      locationbot.py
  2. 1 1
      locationbot.sql

+ 15 - 16
locationbot.py

@@ -3,7 +3,7 @@
 #
 # Douglas Thrift
 #
-# $Id$
+# locationbot.py
 
 from ConfigParser import NoOptionError, SafeConfigParser
 from datetime import datetime, timedelta
@@ -166,21 +166,20 @@ class LocationBot(ircbot.SingleServerIRCBot):
 
 			return geocode
 
-		if coordinates is not None:
-			types = frozenset([
-				'country',
-				'administrative_area_level_1',
-				'administrative_area_level_2',
-				'administrative_area_level_3',
-				'colloquial_area',
-				'locality',
-				'sublocality',
-				'neighborhood',
-			])
-
-			for result in results:
-				if not types.isdisjoint(result['types']):
-					return _result()
+		types = frozenset([
+			'country',
+			'administrative_area_level_1',
+			'administrative_area_level_2',
+			'administrative_area_level_3',
+			'colloquial_area',
+			'locality',
+			'sublocality',
+			'neighborhood',
+		])
+
+		for result in results:
+			if not types.isdisjoint(result['types']):
+				return _result()
 
 		result = results[0]
 

+ 1 - 1
locationbot.sql

@@ -2,7 +2,7 @@
 --
 -- Douglas Thrift
 --
--- $Id$
+-- locationbot.sql
 
 create schema locationbot;