From d933f34e7f9ea9fcc0ea66bf195a871c8f6c13e2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 21 Oct 2012 20:05:06 +0200 Subject: [PATCH] Fix counting downloads. --- www/webapp/handlers_download.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/www/webapp/handlers_download.py b/www/webapp/handlers_download.py index e45f5028..d7ebaaef 100644 --- a/www/webapp/handlers_download.py +++ b/www/webapp/handlers_download.py @@ -87,11 +87,12 @@ class DownloadFileHandler(BaseHandler): mirror = mirrors.get_random() self.redirect(mirror.url + filename[len(mirror.prefix):]) + return mirror def get(self, filename): - return self.head(filename) + mirror = self.head(filename) - # Record the downlaod. + # Record the download. country_code = self.geoip.get_country(self.request.remote_ip) self.mirrors.db.execute("INSERT INTO log_download(filename, mirror, country_code) VALUES(%s, %s, %s)", filename, mirror.id, country_code) -- 2.47.3