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

[tor-commits] [stem/master] Default ignored when geoip was unavailable



commit 92a7c6f8224ce9e69caab7c52b027b77e77dc1e5
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Dec 11 19:38:10 2012 -0800

    Default ignored when geoip was unavailable
    
    We ignored the default argument and always raised a ProtocolError if the geoip
    database was unavalable - oops.
---
 stem/control.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index d538a65..5c3863a 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -778,7 +778,9 @@ class Controller(BaseController):
         params.remove(param)
       elif param.startswith('ip-to-country/') and self.is_geoip_unavailable():
         # the geoip database already looks to be unavailable - abort the request
-        raise stem.ProtocolError("Tor geoip database is unavailable")
+        if default == UNDEFINED:
+          raise stem.ProtocolError("Tor geoip database is unavailable")
+        else: return default
     
     # if everything was cached then short circuit making the query
     if not params:



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