events: fix geoip case when not configured

This commit is contained in:
Jens Langhammer 2021-02-12 10:43:00 +01:00
parent 5417d0a90c
commit bbd088a957
1 changed files with 2 additions and 0 deletions

View File

@ -144,6 +144,8 @@ class Event(models.Model):
def with_geoip(self): def with_geoip(self):
"""Apply GeoIP Data, when enabled""" """Apply GeoIP Data, when enabled"""
if not GEOIP_READER:
return
try: try:
response = GEOIP_READER.city(self.client_ip) response = GEOIP_READER.city(self.client_ip)
self.context["geo"] = { self.context["geo"] = {