Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
e1ea2881
Commit
e1ea2881
authored
Jan 08, 2013
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConnectionPlugin: fix TimeoutTransport on Python 2.7
parent
6f5e0dd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
product/ERP5Type/ConnectionPlugin/TimeoutTransport.py
product/ERP5Type/ConnectionPlugin/TimeoutTransport.py
+11
-18
No files found.
product/ERP5Type/ConnectionPlugin/TimeoutTransport.py
View file @
e1ea2881
...
...
@@ -35,27 +35,20 @@ class TimeoutTransport(SafeTransport):
"""A xmlrpc transport with configurable timeout.
"""
def
__init__
(
self
,
timeout
=
None
,
scheme
=
'http'
):
self
.
_timeout
=
timeout
self
.
_scheme
=
scheme
SafeTransport
.
__init__
(
self
)
transport_class
=
Transport
if
scheme
==
'http'
else
SafeTransport
def
make_connection
(
*
args
,
**
kw
):
connection
=
transport_class
.
make_connection
(
self
,
*
args
,
**
kw
)
if
timeout
is
not
None
:
# BBB: On Python < 2.7, HTTP connection is wrapped
getattr
(
connection
,
'_conn'
,
connection
).
timeout
=
timeout
return
connection
self
.
make_connection
=
make_connection
def
send_content
(
self
,
connection
,
request_body
):
try
:
connection
.
putheader
(
"Content-Type"
,
"text/xml"
)
connection
.
putheader
(
"Content-Length"
,
str
(
len
(
request_body
)))
connection
.
endheaders
()
if
self
.
_timeout
:
connection
.
_conn
.
sock
.
settimeout
(
self
.
_timeout
)
if
request_body
:
connection
.
send
(
request_body
)
return
SafeTransport
.
send_content
(
self
,
connection
,
request_body
)
except
socket
.
error
,
e
:
raise
ProtocolError
(
connection
.
_conn
.
host
,
-
1
,
# BBB: On Python < 2.7, HTTP connection is wrapped
raise
ProtocolError
(
getattr
(
connection
,
'_conn'
,
connection
).
host
,
-
1
,
"Could not connect to server"
,
None
)
def
make_connection
(
self
,
host
):
try
:
if
self
.
_scheme
==
'http'
:
return
Transport
.
make_connection
(
self
,
host
)
return
SafeTransport
.
make_connection
(
self
,
host
)
except
socket
.
error
,
e
:
raise
ProtocolError
(
host
,
-
1
,
"Could not connect to server"
,
None
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment