From 0f6d8da10c259e2299e00260324a3a0e7944e190 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Fri, 11 Jan 2019 17:27:14 +0100 Subject: [PATCH] do not add country name to the GPS coords (fixes #260) --- lib/location.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/location.py b/lib/location.py index 32ce543..b6c401c 100644 --- a/lib/location.py +++ b/lib/location.py @@ -243,7 +243,7 @@ def location_processing(location, ip_addr): # contains some unicode symbols # here we resolve them if location is not None and not ascii_only(location): - location = "~" + location + location = "~" + location.lstrip('~') if location is not None and location.upper() in IATA_CODES: location = '~%s' % location @@ -252,7 +252,10 @@ def location_processing(location, ip_addr): geolocation = geolocator(location_canonical_name(location[1:])) if geolocation is not None: override_location_name = location[1:].replace('+', ' ') + if country: + override_location_name += ", %s" % country location = "%s,%s" % (geolocation['latitude'], geolocation['longitude']) + country = None if not hide_full_address: full_address = geolocation['address'] else: