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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
3ace55e7
Commit
3ace55e7
authored
May 01, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deal with references in zodb_unpickle().
parent
a67f2cd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
src/ZODB/tests/StorageTestBase.py
src/ZODB/tests/StorageTestBase.py
+6
-0
No files found.
src/ZODB/tests/StorageTestBase.py
View file @
3ace55e7
...
@@ -31,6 +31,7 @@ from cPickle import Pickler, Unpickler
...
@@ -31,6 +31,7 @@ from cPickle import Pickler, Unpickler
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
ZODB.Transaction
import
Transaction
from
ZODB.Transaction
import
Transaction
from
ZODB.utils
import
u64
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.MinPO
import
MinPO
...
@@ -64,10 +65,15 @@ def zodb_pickle(obj):
...
@@ -64,10 +65,15 @@ def zodb_pickle(obj):
p
.
dump
(
state
)
p
.
dump
(
state
)
return
f
.
getvalue
(
1
)
return
f
.
getvalue
(
1
)
def
persistent_load
(
pid
):
# helper for zodb_unpickle
return
"ref to %s.%s oid=%s"
%
(
pid
[
1
][
0
],
pid
[
1
][
1
],
u64
(
pid
[
0
]))
def
zodb_unpickle
(
data
):
def
zodb_unpickle
(
data
):
"""Unpickle an object stored using the format expected by ZODB."""
"""Unpickle an object stored using the format expected by ZODB."""
f
=
StringIO
(
data
)
f
=
StringIO
(
data
)
u
=
Unpickler
(
f
)
u
=
Unpickler
(
f
)
u
.
persistent_load
=
persistent_load
klass_info
=
u
.
load
()
klass_info
=
u
.
load
()
if
isinstance
(
klass_info
,
types
.
TupleType
):
if
isinstance
(
klass_info
,
types
.
TupleType
):
if
isinstance
(
klass_info
[
0
],
types
.
TupleType
):
if
isinstance
(
klass_info
[
0
],
types
.
TupleType
):
...
...
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