From b9ca6e20d44b6bbe95c7becc566b351b3f39c1e6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 26 Jan 2015 00:20:26 +0100 Subject: [ClickAndLoad] Fix create_connection in python 2.5 --- module/plugins/hooks/ClickAndLoad.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'module/plugins/hooks/ClickAndLoad.py') diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index c8e5e0e98..80201fe23 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -19,10 +19,11 @@ def forward(source, destination): #: socket.create_connection wrapper for python 2.5 -def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, - source_address=None): +def create_connection(address, timeout=object(), source_address=None): try: - return socket.create_connection(address, timeout, source_address) + return socket.create_connection(address, + socket._GLOBAL_DEFAULT_TIMEOUT if type(timeout) == object else timeout, + source_address) except SyntaxError: """Connect to *address* and return the socket object. @@ -44,7 +45,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, sock = None try: sock = socket(af, socktype, proto) - if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: + if type(timeout) != object: sock.settimeout(timeout) if source_address: sock.bind(source_address) @@ -65,7 +66,7 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.30" __config__ = [("activated", "bool", "Activated" , True ), ("port" , "int" , "Port" , 9666 ), -- cgit v1.2.3