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
3d7e8e4d
Commit
3d7e8e4d
authored
May 15, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug: Cross-database references to databases with empty names
weren't constructed properly.
parent
100a2198
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
7 deletions
+39
-7
src/ZODB/serialize.py
src/ZODB/serialize.py
+2
-2
src/ZODB/tests/test_doctest_files.py
src/ZODB/tests/test_doctest_files.py
+37
-5
No files found.
src/ZODB/serialize.py
View file @
3d7e8e4d
...
@@ -365,7 +365,7 @@ class ObjectWriter:
...
@@ -365,7 +365,7 @@ class ObjectWriter:
# __getnewargs__ of its own, we'll lose the optimization
# __getnewargs__ of its own, we'll lose the optimization
# of caching the class info.
# of caching the class info.
if
database_name
:
if
database_name
is
not
None
:
return
[
'n'
,
(
database_name
,
oid
)]
return
[
'n'
,
(
database_name
,
oid
)]
return
oid
return
oid
...
@@ -373,7 +373,7 @@ class ObjectWriter:
...
@@ -373,7 +373,7 @@ class ObjectWriter:
# Note that we never get here for persistent classes.
# Note that we never get here for persistent classes.
# We'll use direct refs for normal classes.
# We'll use direct refs for normal classes.
if
database_name
:
if
database_name
is
not
None
:
return
[
'm'
,
(
database_name
,
oid
,
klass
)]
return
[
'm'
,
(
database_name
,
oid
,
klass
)]
return
oid
,
klass
return
oid
,
klass
...
...
src/ZODB/tests/test_doctest_files.py
View file @
3d7e8e4d
...
@@ -12,10 +12,42 @@
...
@@ -12,10 +12,42 @@
#
#
##############################################################################
##############################################################################
from
zope.testing.doctestunit
import
DocFileSuite
import
unittest
from
zope.testing
import
doctest
__test__
=
dict
(
cross_db_refs_to_blank_db_name
=
"""
There was a bug that caused bad refs to be generated is a database
name was blank.
>>> import ZODB.tests.util, persistent.mapping, transaction
>>> dbs = {}
>>> db1 = ZODB.tests.util.DB(database_name='', databases=dbs)
>>> db2 = ZODB.tests.util.DB(database_name='2', databases=dbs)
>>> conn1 = db1.open()
>>> conn2 = conn1.get_connection('2')
>>> for i in range(10):
... conn1.root()[i] = persistent.mapping.PersistentMapping()
... transaction.commit()
>>> conn2.root()[0] = conn1.root()[9]
>>> transaction.commit()
>>> conn2.root()._p_deactivate()
>>> conn2.root()[0] is conn1.root()[9]
True
>>> list(conn2.root()[0].keys())
[]
"""
,
)
def
test_suite
():
def
test_suite
():
return
DocFileSuite
(
"dbopen.txt"
,
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
doctest
.
DocFileSuite
(
"dbopen.txt"
,
"multidb.txt"
,
"multidb.txt"
,
"synchronizers.txt"
,
"synchronizers.txt"
,
)
))
suite
.
addTest
(
doctest
.
DocTestSuite
())
return
suite
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