Skip to content

Commit

Permalink
Refactor to use same approach as pybossa/stats.py
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Aug 1, 2013
1 parent 6c61f7e commit 0710f2a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pybossa/view/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ def index():
gic = pygeoip.GeoIP(geolite)
for row in results:
loc = gic.record_by_addr(row.user_ip)
if loc is not None:
if (len(loc.keys()) == 0):
loc['latitude'] = 0
loc['longitude'] = 0
locs.append(dict(loc=loc))
if loc is None:
loc = {}
if (len(loc.keys()) == 0):
loc['latitude'] = 0
loc['longitude'] = 0
locs.append(dict(loc=loc))

show_locs = False
if len(locs) > 0:
Expand Down

0 comments on commit 0710f2a

Please sign in to comment.