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
eb8fb48f
Commit
eb8fb48f
authored
Mar 30, 2009
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using ZEO.hash
parent
f2aff74a
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 @
eb8fb48f
...
@@ -27,14 +27,7 @@ is set to 1 and the MAC immediately follows the length.
...
@@ -27,14 +27,7 @@ is set to 1 and the MAC immediately follows the length.
import
asyncore
import
asyncore
import
errno
import
errno
try
:
import
ZEO.hash
import
hmac
except
ImportError
:
import
_hmac
as
hmac
try
:
from
hashlib
import
sha1
as
sha
except
ImportError
:
import
sha
import
socket
import
socket
import
struct
import
struct
import
threading
import
threading
...
@@ -45,7 +38,7 @@ from ZODB.loglevels import TRACE
...
@@ -45,7 +38,7 @@ from ZODB.loglevels import TRACE
from
ZEO.zrpc.log
import
log
,
short_repr
from
ZEO.zrpc.log
import
log
,
short_repr
from
ZEO.zrpc.error
import
DisconnectedError
from
ZEO.zrpc.error
import
DisconnectedError
import
ZEO.hash
# Use the dictionary to make sure we get the minimum number of errno
# Use the dictionary to make sure we get the minimum number of errno
# entries. We expect that EWOULDBLOCK == EAGAIN on most systems --
# entries. We expect that EWOULDBLOCK == EAGAIN on most systems --
...
@@ -150,8 +143,8 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
...
@@ -150,8 +143,8 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
# and thus iterator, because it contains a yield statement.
# and thus iterator, because it contains a yield statement.
def
hack
():
def
hack
():
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
sha
)
self
.
__hmac_send
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
sha
)
self
.
__hmac_recv
=
hmac
.
HMAC
(
sesskey
,
digestmod
=
ZEO
.
hash
)
if
False
:
if
False
:
yield
''
yield
''
...
...
src/ZODB/POSException.py
View file @
eb8fb48f
...
@@ -15,6 +15,8 @@
...
@@ -15,6 +15,8 @@
$Id$"""
$Id$"""
import
sys
from
ZODB.utils
import
oid_repr
,
readable_tid_repr
from
ZODB.utils
import
oid_repr
,
readable_tid_repr
# BBB: We moved the two transactions to the transaction package
# BBB: We moved the two transactions to the transaction package
...
@@ -34,22 +36,38 @@ _recon.__no_side_effects__ = True
...
@@ -34,22 +36,38 @@ _recon.__no_side_effects__ = True
class
POSError
(
StandardError
):
class
POSError
(
StandardError
):
"""Persistent object system error."""
"""Persistent object system error."""
def
__reduce__
(
self
):
if
sys
.
version_info
[:
2
]
==
(
2
,
6
):
# Cope extra data from internal structures
# The 'message' attribute was deprecated for BaseException with
state
=
self
.
__dict__
.
copy
()
# Python 2.6; here we create descriptor properties to continue using it
state
[
'message'
]
=
self
.
message
def
__set_message
(
self
,
v
):
state
[
'args'
]
=
self
.
args
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."""
"""Key not found in database."""
def
__str__
(
self
):
def
__str__
(
self
):
return
oid_repr
(
self
.
args
[
0
])
return
oid_repr
(
self
.
args
[
0
])
class
ConflictError
(
TransactionError
):
class
ConflictError
(
POSError
,
TransactionError
):
"""Two transactions tried to modify the same object at once.
"""Two transactions tried to modify the same object at once.
This transaction should be resubmitted.
This transaction should be resubmitted.
...
@@ -213,7 +231,7 @@ class BTreesConflictError(ConflictError):
...
@@ -213,7 +231,7 @@ class BTreesConflictError(ConflictError):
return
"BTrees conflict error at %d/%d/%d: %s"
%
(
return
"BTrees conflict error at %d/%d/%d: %s"
%
(
self
.
p1
,
self
.
p2
,
self
.
p3
,
self
.
msgs
[
self
.
reason
])
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.
"""An object has a persistent reference to a missing object.
If an object is stored and it has a reference to another 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