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
3b785e4d
Commit
3b785e4d
authored
Apr 19, 2001
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
checkOldRevisionPacked(): Use _dostoreNP(): to avoid the double
pickling
parent
993fccdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
src/ZODB/tests/PackableStorage.py
src/ZODB/tests/PackableStorage.py
+7
-11
No files found.
src/ZODB/tests/PackableStorage.py
View file @
3b785e4d
...
...
@@ -36,11 +36,6 @@ class PackableStorage:
self
.
_cache
[
obj
.
getoid
()]
=
obj
return
obj
# Override StorageTestBase's method, since we're generating the pickles
# in this class explicitly.
def
_massagedata
(
self
,
data
):
return
data
def
checkOldRevisionPacked
(
self
):
# The initial revision has an object graph like so:
# o1 -> o2 -> o3
...
...
@@ -60,16 +55,17 @@ class PackableStorage:
return
s
.
getvalue
()
p1
,
p2
,
p3
=
map
(
dumps
,
(
o1
,
o2
,
o3
))
# Now commit these objects
revid1
=
self
.
_dostore
(
oid
=
o1
.
getoid
(),
data
=
p1
)
revid2
=
self
.
_dostore
(
oid
=
o2
.
getoid
(),
data
=
p2
)
revid3
=
self
.
_dostore
(
oid
=
o3
.
getoid
(),
data
=
p3
)
revid1
=
self
.
_dostore
NP
(
oid
=
o1
.
getoid
(),
data
=
p1
)
revid2
=
self
.
_dostore
NP
(
oid
=
o2
.
getoid
(),
data
=
p2
)
revid3
=
self
.
_dostore
NP
(
oid
=
o3
.
getoid
(),
data
=
p3
)
# Record this moment in history so we can pack everything before it
t0
=
time
.
time
()
# Now change the object graph to look like so:
# o1 -> o3
# and note that o2 is no longer referenced
o1
.
object
=
o3
revid11
=
self
.
_dostore
(
oid
=
o1
.
getoid
(),
revid
=
revid1
,
data
=
dumps
(
o1
))
p11
=
dumps
(
o1
)
revid11
=
self
.
_dostoreNP
(
oid
=
o1
.
getoid
(),
revid
=
revid1
,
data
=
p11
)
# Pack away transaction 2
self
.
_storage
.
pack
(
t0
,
referencesf
)
# Now, objects 1 and 3 should exist, but object 2 should have been
...
...
@@ -83,11 +79,11 @@ class PackableStorage:
data
,
revid
=
self
.
_storage
.
load
(
o1
.
getoid
(),
''
)
assert
revid
==
revid11
from
ZODB
import
utils
assert
loads
(
loads
(
data
)
).
getoid
()
==
o1
.
getoid
()
assert
loads
(
data
).
getoid
()
==
o1
.
getoid
()
# Get object 3
data
,
revid
=
self
.
_storage
.
load
(
o3
.
getoid
(),
''
)
assert
revid
==
revid2
assert
loads
(
loads
(
data
)
).
getoid
()
==
o3
.
getoid
()
assert
loads
(
data
).
getoid
()
==
o3
.
getoid
()
# Object 2 should fail
self
.
assertRaises
(
KeyError
,
self
.
_storage
.
load
,
o2
.
getoid
(),
''
)
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