Skip to content

Commit

Permalink
Fix geolite path
Browse files Browse the repository at this point in the history
  • Loading branch information
teleyinex committed Mar 14, 2013
1 parent a3b1123 commit b3157af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pybossa/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with PyBOSSA. If not, see <http://www.gnu.org/licenses/>.
from flask import current_app
from sqlalchemy.sql import text
from pybossa.core import cache
from pybossa.core import db
Expand Down Expand Up @@ -309,8 +310,9 @@ def stats_format_users(app_id, users, anon_users, auth_users, geo=False):
top5_auth = []
loc_anon = []
# Check if the GeoLiteCity.dat exists
geolite = current_app.root_path + '/../dat/GeoLiteCity.dat'
if geo:
gic = pygeoip.GeoIP('dat/GeoLiteCity.dat')
gic = pygeoip.GeoIP(geolite)
for u in c_anon_users.most_common(5):
if geo:
loc = gic.record_by_addr(u[0])
Expand Down

0 comments on commit b3157af

Please sign in to comment.