Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
nexedi
ZODB
Commits
1e712938
Commit
1e712938
authored
Jun 25, 2007
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated to reflect differences in exception meta types ebtween Python
2.4 and 2.5.
parent
08b78663
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
src/ZEO/zrpc/connection.py
src/ZEO/zrpc/connection.py
+8
-7
src/ZEO/zrpc/marshal.py
src/ZEO/zrpc/marshal.py
+3
-2
No files found.
src/ZEO/zrpc/connection.py
View file @
1e712938
...
...
@@ -17,7 +17,6 @@ import errno
import
select
import
sys
import
threading
import
types
import
logging
import
traceback
,
time
...
...
@@ -33,6 +32,8 @@ from ZODB.loglevels import BLATHER, TRACE
REPLY
=
".reply"
# message name used for replies
ASYNC
=
1
exception_type_type
=
type
(
Exception
)
##############################################################################
# Dedicated Client select loop:
client_timeout
=
30.0
...
...
@@ -361,7 +362,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
assert
tag
in
"CS"
self
.
tag
=
tag
self
.
logger
=
logging
.
getLogger
(
'ZEO.zrpc.Connection(%c)'
%
tag
)
if
isinstance
(
addr
,
t
ypes
.
TupleTyp
e
):
if
isinstance
(
addr
,
t
upl
e
):
self
.
log_label
=
"(%s:%d) "
%
addr
else
:
self
.
log_label
=
"(%s) "
%
addr
...
...
@@ -604,7 +605,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
self
.
log
(
"Asynchronous call raised exception: %s"
%
self
,
level
=
logging
.
ERROR
,
exc_info
=
True
)
return
if
type
(
err_value
)
is
not
types
.
InstanceType
:
if
not
isinstance
(
err_value
,
Exception
)
:
err_value
=
err_type
,
err_value
# encode() can pass on a wide variety of exceptions from cPickle.
...
...
@@ -664,8 +665,8 @@ class Connection(smac.SizedMessageAsyncConnection, object):
raise
DisconnectedError
()
msgid
=
self
.
send_call
(
method
,
args
,
0
)
r_flags
,
r_args
=
self
.
wait
(
msgid
)
if
(
isinstance
(
r_args
,
t
ypes
.
TupleTyp
e
)
and
len
(
r_args
)
>
1
and
type
(
r_args
[
0
])
==
types
.
ClassT
ype
if
(
isinstance
(
r_args
,
t
upl
e
)
and
len
(
r_args
)
>
1
and
type
(
r_args
[
0
])
==
exception_type_t
ype
and
issubclass
(
r_args
[
0
],
Exception
)):
inst
=
r_args
[
1
]
raise
inst
# error raised by server
...
...
@@ -687,8 +688,8 @@ class Connection(smac.SizedMessageAsyncConnection, object):
def
_deferred_wait
(
self
,
msgid
):
r_flags
,
r_args
=
self
.
wait
(
msgid
)
if
(
isinstance
(
r_args
,
t
ypes
.
TupleTyp
e
)
and
type
(
r_args
[
0
])
==
types
.
ClassT
ype
if
(
isinstance
(
r_args
,
t
upl
e
)
and
type
(
r_args
[
0
])
==
exception_type_t
ype
and
issubclass
(
r_args
[
0
],
Exception
)):
inst
=
r_args
[
1
]
raise
inst
# error raised by server
...
...
src/ZEO/zrpc/marshal.py
View file @
1e712938
...
...
@@ -13,7 +13,6 @@
##############################################################################
import
cPickle
from
cStringIO
import
StringIO
import
types
import
logging
from
ZEO.zrpc.error
import
ZRPCError
...
...
@@ -56,6 +55,8 @@ class Marshaller:
_globals
=
globals
()
_silly
=
(
'__doc__'
,)
exception_type_type
=
type
(
Exception
)
def
find_global
(
module
,
name
):
"""Helper for message unpickler"""
try
:
...
...
@@ -73,7 +74,7 @@ def find_global(module, name):
return
r
# TODO: is there a better way to do this?
if
type
(
r
)
==
types
.
ClassT
ype
and
issubclass
(
r
,
Exception
):
if
type
(
r
)
==
exception_type_t
ype
and
issubclass
(
r
,
Exception
):
return
r
raise
ZRPCError
(
"Unsafe global: %s.%s"
%
(
module
,
name
))
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