Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
return location.Database("/var/lib/location/database.db")
def get_country_name(self, country_code):
- country = self.location.get_country(country_code)
+ try:
+ country = self.location.get_country(country_code)
+
+ # In case the country code was invalid, we return it again
+ except ValueError:
+ return country_code
if country:
return country.name
+ return country_code
+
@lazy_property
def ratelimiter(self):
return ratelimit.RateLimiter(self)