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

[tor-commits] [ooni-probe/master] Cast two objects to string to avoid log_encode complaining when in debug mode.



commit 2d0289437255dd36460acc220a8226def261f24a
Author: Arturo Filastò <art@xxxxxxxxx>
Date:   Sat May 31 20:20:14 2014 +0200

    Cast two objects to string to avoid log_encode complaining when in debug mode.
---
 ooni/managers.py       |    2 +-
 ooni/templates/dnst.py |    8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ooni/managers.py b/ooni/managers.py
index f201a03..ca1cd5b 100644
--- a/ooni/managers.py
+++ b/ooni/managers.py
@@ -196,7 +196,7 @@ class ReportEntryManager(LinkedTaskManager):
 
     def succeeded(self, result, task):
         log.debug("Successfully performed report %s" % task)
-        log.debug(result)
+        log.debug(str(result))
 
     def failed(self, failure, task):
         pass
diff --git a/ooni/templates/dnst.py b/ooni/templates/dnst.py
index 70c9c8e..7c9626c 100644
--- a/ooni/templates/dnst.py
+++ b/ooni/templates/dnst.py
@@ -3,13 +3,11 @@
 # :authors: Arturo Filastò
 # :licence: see LICENSE
 
-from twisted.internet import defer, udp, error, base
+from twisted.internet import udp, error, base
 from twisted.internet.defer import TimeoutError
 from twisted.names import client, dns
 from twisted.names.client import Resolver
 
-from twisted.names.error import DNSQueryRefusedError
-
 from ooni.utils import log
 from ooni.nettest import NetTestCase
 from ooni.errors import failureToString
@@ -32,7 +30,7 @@ def _bindSocket(self):
     # Make sure that if we listened on port 0, we update that to
     # reflect what the OS actually assigned us.
     self._realPortNumber = skt.getsockname()[1]
-    
+
     # Here we remove the logging.
     # log.msg("%s starting on %s" % (
     #         self._getLogPrefix(self.protocol), self._realPortNumber))
@@ -144,7 +142,7 @@ class DNSTest(NetTestCase):
         query = [dns.Query(hostname, dnsType, dns.IN)]
         def gotResponse(message):
             log.debug(dns_type+" Lookup successful")
-            log.debug(message)
+            log.debug(str(message))
             addrs = []
             answers = []
             if dns_server:



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