summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-26 00:20:26 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-26 00:20:26 +0100
commitb9ca6e20d44b6bbe95c7becc566b351b3f39c1e6 (patch)
tree2b588078f55ed45e1a0591310c9758faa7ef05ac /module
parent[UploadedTo] Fix https://github.com/pyload/pyload/issues/1069#issuecomment-71... (diff)
downloadpyload-b9ca6e20d44b6bbe95c7becc566b351b3f39c1e6.tar.xz
[ClickAndLoad] Fix create_connection in python 2.5
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hooks/ClickAndLoad.py11
1 files changed, 6 insertions, 5 deletions
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 ),