[tor-commits] [oonib/master] remove mutable class-level variable that's always overridden by a fresh instance variable with the same name (at least within this code, and I'm going to assume that's how it's meant to be used)

art at torproject.org art at torproject.org
Wed Apr 23 14:31:52 UTC 2014


commit 64615d89908b18469281d84b2cbe70b7a3a110d8
Author: Darius Bacon <darius at wry.me>
Date:   Wed Apr 16 12:28:59 2014 -0700

    remove mutable class-level variable that's always overridden by a fresh instance variable with the same name (at least within this code, and I'm going to assume that's how it's meant to be used)
---
 oonib/testhelpers/http_helpers.py |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/oonib/testhelpers/http_helpers.py b/oonib/testhelpers/http_helpers.py
index 3a76b9a..8f09326 100644
--- a/oonib/testhelpers/http_helpers.py
+++ b/oonib/testhelpers/http_helpers.py
@@ -40,11 +40,11 @@ class SimpleHTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
     length = 0
     maxHeaders = 500
     requestLine = ''
-    headers = []
 
     timeOut = 60 * 60 * 12
 
     def __init__(self):
+        self.headers = []
         self.requests = []
 
     def connectionMade(self):
@@ -98,9 +98,7 @@ class SimpleHTTPChannel(basic.LineReceiver, policies.TimeoutMixin):
 class HTTPReturnJSONHeadersHelper(protocol.ServerFactory):
     protocol = SimpleHTTPChannel
     def buildProtocol(self, addr):
-        p = self.protocol()
-        p.headers = []
-        return p
+        return self.protocol()
 
 class HTTPTrapAll(RequestHandler):
     def _execute(self, transforms, *args, **kwargs):





More information about the tor-commits mailing list