diff tests/tinyproxy.py @ 14971:0b21ae0a2366

tests: use getattr instead of hasattr
author Augie Fackler <durin42@gmail.com>
date Mon, 25 Jul 2011 16:37:18 -0500
parents 1ffeeb91c55d
children 74e114ac6ec1
line wrap: on
line diff
--- a/tests/tinyproxy.py	Mon Jul 25 16:05:01 2011 -0500
+++ b/tests/tinyproxy.py	Mon Jul 25 16:37:18 2011 -0500
@@ -23,7 +23,8 @@
 
     def handle(self):
         (ip, port) =  self.client_address
-        if hasattr(self, 'allowed_clients') and ip not in self.allowed_clients:
+        allowed = getattr(self, 'allowed_clients', None)
+        if allowed is not None and ip not in allowed:
             self.raw_requestline = self.rfile.readline()
             if self.parse_request():
                 self.send_error(403)