From: Michael Tremer Date: Tue, 17 Jul 2018 10:25:33 +0000 (+0100) Subject: donation: Add list of countries X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=47113f9e8e220317349bc0308155d5acd48d287b;p=ipfire.org.git donation: Add list of countries And select the right one based on GeoIP location Signed-off-by: Michael Tremer --- diff --git a/src/templates/donate.html b/src/templates/donate.html index 45307bb6..9caa667e 100644 --- a/src/templates/donate.html +++ b/src/templates/donate.html @@ -213,10 +213,10 @@
diff --git a/src/web/handlers.py b/src/web/handlers.py index cc710d2b..15f3b3ea 100644 --- a/src/web/handlers.py +++ b/src/web/handlers.py @@ -1,6 +1,7 @@ #!/usr/bin/python #import httplib +import iso3166 #import logging #import markdown2 import operator @@ -93,7 +94,14 @@ class GeoIPHandler(BaseHandler): class DonateHandler(BaseHandler): def get(self): - self.render("donate.html") + location = self.get_remote_location() + + if location: + country = location.country + else: + country = None + + self.render("donate.html", countries=iso3166.countries, country=country) @tornado.gen.coroutine def post(self):