From 6bf0798a8dfb1ec8754189701b635db637f69414 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 22 May 2022 15:15:04 +0100 Subject: [PATCH] Tidying --- maps.py | 5 ++++- posts.py | 3 +-- webapp_post.py | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/maps.py b/maps.py index 8c4a52223..27d9e4586 100644 --- a/maps.py +++ b/maps.py @@ -194,7 +194,10 @@ def _geocoords_from_wego_link(url: str) -> (int, float, float): return zoom, latitude, longitude -def geocoords_from_map_link(url: str, osm_domain: str) -> (int, float, float): +def geocoords_from_map_link(url: str, + osm_domain: str = 'openstreetmap.org') -> (int, + float, + float): """Returns geocoordinates from a map link url """ if osm_domain in url: diff --git a/posts.py b/posts.py index c9be4ccc9..2a270f709 100644 --- a/posts.py +++ b/posts.py @@ -1283,9 +1283,8 @@ def _create_post_place_and_time(event_date: str, end_date: str, if location and not event_uuid: latitude = longitude = None if '://' in location: - osm_domain = 'openstreetmap.org' _, latitude, longitude = \ - geocoords_from_map_link(location, osm_domain) + geocoords_from_map_link(location) if latitude and longitude: tags.append({ "@context": "https://www.w3.org/ns/activitystreams", diff --git a/webapp_post.py b/webapp_post.py index 12fd9451f..e70c87796 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -2187,9 +2187,8 @@ def individual_post_as_html(signing_priv_key_pem: str, set_map_preferences_url(base_dir, nickname, domain, location_domain) # remember the coordinates - osm_domain = 'openstreetmap.org' map_zoom, map_latitude, map_longitude = \ - geocoords_from_map_link(location_str, osm_domain) + geocoords_from_map_link(location_str) if map_zoom and map_latitude and map_longitude: set_map_preferences_coords(base_dir, nickname, domain, map_latitude, map_longitude,