https://lists.ipfire.org/pipermail/location/2020-August/000131.html
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
@property
def country_name(self):
if self.country_code:
- return countries.get_name(self.country_code)
+ return self.backend.get_country_name(self.country_code)
@property
def email(self):
def location(self):
return location.Database("/var/lib/location/database.db")
+ def get_country_name(self, country_code):
+ country = self.location.get_country(country_code)
+
+ if country:
+ return country.name
+
@lazy_property
def ratelimiter(self):
return ratelimit.RateLimiter(self)
import logging
import re
-from . import countries
from . import database
from . import hwdata
from . import util
@property
def location_string(self):
- return countries.get_name(self.location)
+ return self.backend.get_country_name(self.location) or self.location
# Devices
logging.info("Successfully initialied application")
def format_country_name(self, handler, country_code):
- return ipfire.countries.get_name(country_code)
+ return self.backend.get_country_name(country_code)
def format_language_name(self, handler, language):
_ = handler.locale.translate