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
Kirill Smelkov
ZODB
Commits
50bb723f
Commit
50bb723f
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
a63d61d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
trunk/src/ZODB/tests/PackableStorage.py
trunk/src/ZODB/tests/PackableStorage.py
+7
-11
No files found.
trunk/src/ZODB/tests/PackableStorage.py
View file @
50bb723f
...
@@ -36,11 +36,6 @@ class PackableStorage:
...
@@ -36,11 +36,6 @@ class PackableStorage:
self
.
_cache
[
obj
.
getoid
()]
=
obj
self
.
_cache
[
obj
.
getoid
()]
=
obj
return
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
):
def
checkOldRevisionPacked
(
self
):
# The initial revision has an object graph like so:
# The initial revision has an object graph like so:
# o1 -> o2 -> o3
# o1 -> o2 -> o3
...
@@ -60,16 +55,17 @@ class PackableStorage:
...
@@ -60,16 +55,17 @@ class PackableStorage:
return
s
.
getvalue
()
return
s
.
getvalue
()
p1
,
p2
,
p3
=
map
(
dumps
,
(
o1
,
o2
,
o3
))
p1
,
p2
,
p3
=
map
(
dumps
,
(
o1
,
o2
,
o3
))
# Now commit these objects
# Now commit these objects
revid1
=
self
.
_dostore
(
oid
=
o1
.
getoid
(),
data
=
p1
)
revid1
=
self
.
_dostore
NP
(
oid
=
o1
.
getoid
(),
data
=
p1
)
revid2
=
self
.
_dostore
(
oid
=
o2
.
getoid
(),
data
=
p2
)
revid2
=
self
.
_dostore
NP
(
oid
=
o2
.
getoid
(),
data
=
p2
)
revid3
=
self
.
_dostore
(
oid
=
o3
.
getoid
(),
data
=
p3
)
revid3
=
self
.
_dostore
NP
(
oid
=
o3
.
getoid
(),
data
=
p3
)
# Record this moment in history so we can pack everything before it
# Record this moment in history so we can pack everything before it
t0
=
time
.
time
()
t0
=
time
.
time
()
# Now change the object graph to look like so:
# Now change the object graph to look like so:
# o1 -> o3
# o1 -> o3
# and note that o2 is no longer referenced
# and note that o2 is no longer referenced
o1
.
object
=
o3
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
# Pack away transaction 2
self
.
_storage
.
pack
(
t0
,
referencesf
)
self
.
_storage
.
pack
(
t0
,
referencesf
)
# Now, objects 1 and 3 should exist, but object 2 should have been
# Now, objects 1 and 3 should exist, but object 2 should have been
...
@@ -83,11 +79,11 @@ class PackableStorage:
...
@@ -83,11 +79,11 @@ class PackableStorage:
data
,
revid
=
self
.
_storage
.
load
(
o1
.
getoid
(),
''
)
data
,
revid
=
self
.
_storage
.
load
(
o1
.
getoid
(),
''
)
assert
revid
==
revid11
assert
revid
==
revid11
from
ZODB
import
utils
from
ZODB
import
utils
assert
loads
(
loads
(
data
)
).
getoid
()
==
o1
.
getoid
()
assert
loads
(
data
).
getoid
()
==
o1
.
getoid
()
# Get object 3
# Get object 3
data
,
revid
=
self
.
_storage
.
load
(
o3
.
getoid
(),
''
)
data
,
revid
=
self
.
_storage
.
load
(
o3
.
getoid
(),
''
)
assert
revid
==
revid2
assert
revid
==
revid2
assert
loads
(
loads
(
data
)
).
getoid
()
==
o3
.
getoid
()
assert
loads
(
data
).
getoid
()
==
o3
.
getoid
()
# Object 2 should fail
# Object 2 should fail
self
.
assertRaises
(
KeyError
,
self
.
assertRaises
(
KeyError
,
self
.
_storage
.
load
,
o2
.
getoid
(),
''
)
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