Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
1f149559
Commit
1f149559
authored
Mar 30, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using ZEO.hash
parent
e48d4edf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
20 deletions
+31
-20
src/ZEO/zrpc/smac.py
src/ZEO/zrpc/smac.py
+4
-11
src/ZODB/POSException.py
src/ZODB/POSException.py
+27
-9
No files found.
src/ZEO/zrpc/smac.py
View file @
1f149559
...
...
@@ -27,14 +27,7 @@ is set to 1 and the MAC immediately follows the length.
import
asyncore
import
errno
try
:
import
hmac
except
ImportError
:
import
_hmac
as
hmac
try
:
from
hashlib
import
sha1
as
sha
except
ImportError
:
import
sha
import
ZEO.hash
import
socket
import
struct
import
threading
...
...
@@ -45,7 +38,7 @@ from ZODB.loglevels import TRACE
from
ZEO.zrpc.log
import
log
,
short_repr
from
ZEO.zrpc.error
import
DisconnectedError
import
ZEO.hash
# Use the dictionary to make sure we get the minimum number of errno
# entries. We expect that EWOULDBLOCK == EAGAIN on most systems --
...
...
@@ -150,8 +143,8 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
# and thus iterator, because it contains a yield statement.
def
hack
():
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
sha
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
sha
)
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
if
False
:
yield
''
...
...
src/ZODB/POSException.py
View file @
1f149559
...
...
@@ -15,6 +15,8 @@
$Id$"""
import
sys
from
ZODB.utils
import
oid_repr
,
readable_tid_repr
# BBB: We moved the two transactions to the transaction package
...
...
@@ -34,22 +36,38 @@ _recon.__no_side_effects__ = True
class
POSError
(
StandardError
):
"""Persistent object system error."""
def
__reduce__
(
self
):
# Cope extra data from internal structures
state
=
self
.
__dict__
.
copy
()
state
[
'message'
]
=
self
.
message
state
[
'args'
]
=
self
.
args
if
sys
.
version_info
[:
2
]
==
(
2
,
6
):
# The 'message' attribute was deprecated for BaseException with
# Python 2.6; here we create descriptor properties to continue using it
def
__set_message
(
self
,
v
):
self
.
__dict__
[
'message'
]
=
v
def
__get_message
(
self
):
return
self
.
__dict__
[
'message'
]
def
__del_message
(
self
):
del
self
.
__dict__
[
'message'
]
message
=
property
(
__get_message
,
__set_message
,
__del_message
)
if
sys
.
version_info
[:
2
]
>=
(
2
,
5
):
def
__reduce__
(
self
):
# Copy extra data from internal structures
state
=
self
.
__dict__
.
copy
()
if
sys
.
version_info
[:
2
]
==
(
2
,
5
):
state
[
'message'
]
=
self
.
message
state
[
'args'
]
=
self
.
args
return
(
_recon
,
(
self
.
__class__
,
state
))
return
(
_recon
,
(
self
.
__class__
,
state
))
class
POSKeyError
(
KeyError
,
POS
Error
):
class
POSKeyError
(
POSError
,
Key
Error
):
"""Key not found in database."""
def
__str__
(
self
):
return
oid_repr
(
self
.
args
[
0
])
class
ConflictError
(
TransactionError
):
class
ConflictError
(
POSError
,
TransactionError
):
"""Two transactions tried to modify the same object at once.
This transaction should be resubmitted.
...
...
@@ -213,7 +231,7 @@ class BTreesConflictError(ConflictError):
return
"BTrees conflict error at %d/%d/%d: %s"
%
(
self
.
p1
,
self
.
p2
,
self
.
p3
,
self
.
msgs
[
self
.
reason
])
class
DanglingReferenceError
(
TransactionError
):
class
DanglingReferenceError
(
POSError
,
TransactionError
):
"""An object has a persistent reference to a missing object.
If an object is stored and it has a reference to another object
...
...
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