]> granicus.if.org Git - python/commitdiff
Remove a dict.has_key() and callable() usage in SimpleXMLRPCServer as triggered
authorBrett Cannon <bcannon@gmail.com>
Sun, 3 Aug 2008 22:57:23 +0000 (22:57 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sun, 3 Aug 2008 22:57:23 +0000 (22:57 +0000)
under -3 through test_xmlrpc.

Lib/SimpleXMLRPCServer.py

index 5fad0af4a344bbdbdbd5e445712d7c44923341bd..43757a03ddaf259e96bd9b8e8d2f59cf8f845a9c 100644 (file)
@@ -141,7 +141,7 @@ def list_public_methods(obj):
 
     return [member for member in dir(obj)
                 if not member.startswith('_') and
-                    callable(getattr(obj, member))]
+                    hasattr(getattr(obj, member), '__call__')]
 
 def remove_duplicates(lst):
     """remove_duplicates([2,2,2,1,3,3]) => [3,1,2]
@@ -315,7 +315,7 @@ class SimpleXMLRPCDispatcher:
         Returns a string containing documentation for the specified method."""
 
         method = None
-        if self.funcs.has_key(method_name):
+        if method_name in self.funcs:
             method = self.funcs[method_name]
         elif self.instance is not None:
             # Instance can implement _methodHelp to return help for a method