Example #1
0
    def add_flag(country, ip):
        if not country:
            try:
                geo = get_geoip_info(resolve_dns(ip).split(':')[0])
                country = geo['country_iso'].lower()
            except (ValueError, AttributeError):
                pass

        return '<span>%s %s</span>' % (get_flag(country), ip)
Example #2
0
    def add_flag(country, ip):
        if not country:
            try:
                geo = get_geoip_info(resolve_dns(ip).split(':')[0])
                country = geo['country_iso'].lower()
            except ValueError:
                pass

        return '<span>%s %s</span>' % (get_flag(country), ip)