[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Fixed a misnamed variable, and a call to log.err when there was not an error



commit 4df3c8d2d0d55f4dd1ca5cce809f31e13c961aa6
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Mon Dec 17 09:27:18 2012 +0000

    Fixed a misnamed variable, and a call to log.err when there was not an error
    followed by an unhandled exception in ooni/utils/geodata.py.
---
 ooni/utils/geodata.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/ooni/utils/geodata.py b/ooni/utils/geodata.py
index 07cc55d..d089490 100644
--- a/ooni/utils/geodata.py
+++ b/ooni/utils/geodata.py
@@ -35,7 +35,7 @@ def myIP(*args, **kwargs):
     target_site = 'https://check.torproject.org/'
     regexp = "Your IP address appears to be: <b>(.+?)<\/b>"
     if 'connectTimeout' in kwargs:
-        myAgent = Agent(reactor, connectTimeout=connectTimeout)
+        myAgent = Agent(reactor, connectTimeout=kwargs['connectTimeout'])
     else:
         myAgent = Agent(reactor, *args, **kwargs)
 
@@ -73,9 +73,11 @@ def IPToLocation(ipaddr):
         asn_dat = pygeoip.GeoIP(asn_file)
         location['asn'] = asn_dat.org_by_addr(ipaddr)
     except IOError:
-        log.err("Could not find GeoIP data files. Go into data/ "
-                "and run make geoip")
-        raise GeoIPDataFilesNotFound
+        try:
+            raise GeoIPDataFilesNotFound(
+                "Couldn't find GeoIP files. Go to ./data and run \"make geoip\".")
+        except GeoIPDataFilesNotFound, gnf:
+            log.err(gnf)
 
     return location
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits