[tor-commits] [ooni-probe/master] Fix the logic on detecting if we have a config setting.

art at torproject.org art at torproject.org
Tue Apr 30 13:01:43 UTC 2013


commit c0b2e453e20303780b941d90c54aa04fd8b6a1ec
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Feb 28 03:56:25 2013 +0000

    Fix the logic on detecting if we have a config setting.
    
     * We can't use hasattr(config.basic, 'foo') because this gives None if not
       set, which means the default in the test doesn't get set. Instead, we want
       to use:
           if getattr(config.basic, 'foo', None) is not None:
---
 nettests/experimental/tls_handshake.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/nettests/experimental/tls_handshake.py b/nettests/experimental/tls_handshake.py
index c57545c..8bd4820 100644
--- a/nettests/experimental/tls_handshake.py
+++ b/nettests/experimental/tls_handshake.py
@@ -138,8 +138,8 @@ class TLSHandshakeTest(nettest.NetTestCase):
                             self.ciphers.append(line.strip())
             self.ciphersuite = ":".join(self.ciphers)
 
-        if hasattr(config.advanced, 'default_timeout'):
-            timeout = config.advanced.default_timeout
+        if getattr(config.advanced, 'default_timeout', None) is not None:
+            self.timeout = config.advanced.default_timeout
         else:
             timeout = 10   ## default the timeout to 10 seconds
         socket.setdefaulttimeout(timeout)





More information about the tor-commits mailing list