[tor-commits] [ooni-probe/master] Still getting the error from ../plugoo/test.py that "d" is a NoneType.

isis at torproject.org isis at torproject.org
Thu Sep 13 13:04:15 UTC 2012


commit 2004db08a6c8f2c93bf3485864a3d6eba93b8ad0
Author: Isis Lovecruft <isis at patternsinthevoid.net>
Date:   Sun Aug 26 09:53:14 2012 +0000

    Still getting the error from ../plugoo/test.py that "d" is a NoneType.
    I'll try merging master and see if that fixes it, else I'll have to patch
    that before continuing.
---
 ooni/plugins/dnstamper.py |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/ooni/plugins/dnstamper.py b/ooni/plugins/dnstamper.py
index 8e8563a..54cfbdf 100644
--- a/ooni/plugins/dnstamper.py
+++ b/ooni/plugins/dnstamper.py
@@ -154,10 +154,10 @@ class DNSTamperTest(OONITest):
 
     def load_assets(self):
         assets = {}
-
-        default_hostnames = ['baidu.com', 'torrentz.eu', 'twitter.com', 
-                             'ooni.nu', 'google.com', 'torproject.org']
-        default_resolvers = ['209.244.0.3', '208.67.222.222']
+        
+        #default_hostnames = ['baidu.com', 'torrentz.eu', 'twitter.com', 
+        #                     'ooni.nu', 'google.com', 'torproject.org']
+        #default_resolvers = ['209.244.0.3', '208.67.222.222']
 
         def asset_file(asset_option):
             return self.local_options[asset_option]
@@ -172,24 +172,25 @@ class DNSTamperTest(OONITest):
 
         if self.local_options:
             if asset_file('hostnames'):
-                with asset_file('hostnames') as hosts_file:
-                    ## The default filename for the Alexa Top 1 Million:
-                    if hosts_file is 'top-1m.txt':
-                        assets.update({'hostnames': AlexaAsset(hosts_file)})
-                    else:
-                        assets.update({'hostnames': Asset(hosts_file)})
+                ## The default filename for the Alexa Top 1 Million:
+                if assets_file('hostnames') is 'top-1m.txt':
+                    assets.update({'hostnames': 
+                                   AlexaAsset(assets_file('hostnames'))})
+                else:
+                    assets.update({'hostnames': 
+                                   Asset(assets_file('hostnames'))})
             else:
                 log.msg("Error! We need an asset file containing the " + 
                         "hostnames that we should test DNS with! Please use " + 
                         "the '-h' option. Using pre-defined hostnames...")
-                assets.update({'hostnames': list_to_asset(default_hostnames)})
+                #assets.update({'hostnames': list_to_asset(default_hostnames)})
 
             if asset_file('testresolvers'):
-                with asset_file('testresolvers') as resolver_file:
-                    assets.update({'testresolvers': Asset(resolver_file)})
-            else:
                 assets.update({'testresolvers': 
-                               list_to_asset(default_resolvers)})
+                               Asset(asset_file('testresolvers'))})
+            #else:
+            #    assets.update({'testresolvers': 
+            #                   list_to_asset(asset_file('testresolvers'))})
 
         return assets
 
@@ -273,9 +274,12 @@ class DNSTamperTest(OONITest):
         """
         for hostname in args:
             for testresolver in self.assets['testresolvers']:
-                addressd = defer.Deferred()
-                addressd.addCallback(self.lookup, hostname, testresolver)
-                addressd.addErrback(log.err)
+                #addressd = defer.Deferred()
+                #addressd.addCallback(self.lookup, hostname, testresolver)
+                #addressd.addErrback(log.err)
+
+                self.d.addCallback(self.lookup, hostname, testresolver)
+                self.d.addErrback(log.err)
 
                 #addressd = self.lookup(hostname, testresolver)
 
@@ -283,7 +287,7 @@ class DNSTamperTest(OONITest):
 
                 print "%s" % type(addressd)
 
-                return addressd
+                return self.d
 
     def control(self, experiment_result, args):
         print "EXPERIMENT RESULT IS %s" % experiment_result





More information about the tor-commits mailing list