def open_or_die(self): ''' Open the database or die ''' if not GEOIP: logging.error("Missing dependency: GeoIP") logging.info("Please install GeoIP python wrappers, e.g.") logging.info(" sudo apt-get install python-geoip") sys.exit(1) path = CONFIG.get("rendezvous.geoip_wrapper.country_database", COUNTRY_DATABASE) # # Detect the common error case, i.e. that the user has # not downloaded the database. If something fancy is # going on, let the GeoIP library stacktrace for us. # if not os.path.exists(path): logging.error("Missing GeoLiteCountry database: %s", path) logging.info("Please download it from " "<http://www.maxmind.com/app/geolitecountry>.") sys.exit(1) self.countries = GEOIP.open(path, GEOIP.GEOIP_STANDARD)
def open_or_die(self): path = CONFIG.get("rendezvous.geoip_wrapper.country_database", COUNTRY_DATABASE) # # Detect the common error case, i.e. that the user has # not downloaded the database. If something fancy is # going on, let the GeoIP library stacktrace for us. # if not os.path.exists(path): LOG.error("Missing GeoLiteCountry database: %s" % path) LOG.info("Please download it from " "<http://www.maxmind.com/app/geolitecountry>.") sys.exit(1) self.countries = GeoIP.open(path, GeoIP.GEOIP_STANDARD)