iwla

iwla Commit Details

Date:2016-02-07 10:17:32 (5 years 5 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:9bb188b6fca158ff8f7c827fd888771805799740
Parents: 19e9b9d4fb7df715c3ff7d9b6236894176ea14ed
Message:Check for presence of country_code field to avoid key error exception

Changes:
Mplugins/display/ip_to_geo.py (1 diff)

File differences

plugins/display/ip_to_geo.py
7070
7171
7272
73
73
7474
7575
7676
77
77
7878
7979
8080
cc = None
host_name = host.split(' ')[0] # hostname or ip
if host_name in self.valid_visitors.keys():
cc = self.valid_visitors[host_name]['country_code']
cc = self.valid_visitors[host_name].get('country_code', None)
else:
for visitor in self.valid_visitors.values():
if visitor['remote_addr'] == host_name:
cc = visitor['country_code']
cc = visitor.get('country_code', None)
break
if not cc or cc == 'ip': return None
icon = '<img src="/%s/flags/%s.png"/>' % (self.icon_path, cc)

Archive Download the corresponding diff file

Branches

Tags