Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
fix: Suppress warnings in geocoding errors in Person model save method
Browse files Browse the repository at this point in the history
  • Loading branch information
hepplerj committed May 13, 2024
1 parent 4dc055c commit 7df6b5f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions postcards/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ def save(self, *args, **kwargs):
location = geolocator.geocode(location_string)
logger.info(f"Geocoding: {location_string}")

self.latitude = str(location.latitude)
self.longitude = str(location.longitude)
if location is not None:
self.latitude = str(location.latitude)
self.longitude = str(location.longitude)
except Exception as e:
logger.warning("Warning in geocoding a Person: " + str(e) + str(self))
super().save(*args, **kwargs)
Expand Down

0 comments on commit 7df6b5f

Please sign in to comment.