[Pkg-privacy-commits] [onioncircuits] 24/62: Don't fail when the country returned by Tor is wrong

Intrigeri intrigeri at moszumanska.debian.org
Thu Feb 18 20:20:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch master
in repository onioncircuits.

commit 25135c53453dadf5ae8b43a68c7b6a6cc5e642d9
Author: Tails developers <tails at boum.org>
Date:   Tue Feb 24 18:57:25 2015 +0100

    Don't fail when the country returned by Tor is wrong
    
    It happens that Tor returns "??" as a country. In case the country
    isnt' known by pycountry, just display the string returned by Tor.
---
 tormonitor | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tormonitor b/tormonitor
index 1fc2a62..82c4bfc 100755
--- a/tormonitor
+++ b/tormonitor
@@ -531,7 +531,12 @@ class TorMonitorWindow(Gtk.ApplicationWindow):
         """
         country = self.controller.get_info("ip-to-country/%s" % status_entry.address)
         if pycountry:
-            country = pycountry.countries.get(alpha2=country.upper()).name
+            try:
+                country = pycountry.countries.get(alpha2=country.upper()).name
+            except KeyError:
+                # If pycountry can't find the country, just display the string
+                # returned by Tor.
+                pass
 
         grid = Gtk.Grid()
         grid.set_property('row-spacing', 6)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onioncircuits.git



More information about the Pkg-privacy-commits mailing list