Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
09545b1d
Commit
09545b1d
authored
Mar 16, 2005
by
Godefroid Chapelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port PersistentList and Mapping fix from ZODB Head
parent
f062ecd1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
lib/python/ZODB/__init__.py
lib/python/ZODB/__init__.py
+12
-4
lib/python/ZODB/tests/testPersistentList.py
lib/python/ZODB/tests/testPersistentList.py
+4
-0
lib/python/ZODB/tests/testPersistentMapping.py
lib/python/ZODB/tests/testPersistentMapping.py
+15
-2
No files found.
lib/python/ZODB/__init__.py
View file @
09545b1d
...
@@ -19,13 +19,21 @@ import sys
...
@@ -19,13 +19,21 @@ import sys
import
__builtin__
import
__builtin__
from
persistent
import
TimeStamp
from
persistent
import
TimeStamp
from
DB
import
DB
from
persistent
import
list
from
transaction
import
get
as
get_transaction
from
persistent
import
mapping
# Backward compat for old imports. I don't think TimeStamp should
# Backward compat for old imports.
# really be in persistent anyway.
sys
.
modules
[
'ZODB.TimeStamp'
]
=
sys
.
modules
[
'persistent.TimeStamp'
]
sys
.
modules
[
'ZODB.TimeStamp'
]
=
sys
.
modules
[
'persistent.TimeStamp'
]
sys
.
modules
[
'ZODB.PersistentMapping'
]
=
sys
.
modules
[
'persistent.mapping'
]
sys
.
modules
[
'ZODB.PersistentList'
]
=
sys
.
modules
[
'persistent.list'
]
del
mapping
,
list
,
sys
from
DB
import
DB
from
transaction
import
get
as
get_transaction
# TODO Issue deprecation warning if this variant is used?
# TODO Issue deprecation warning if this variant is used?
__builtin__
.
get_transaction
=
get_transaction
__builtin__
.
get_transaction
=
get_transaction
del
__builtin__
del
__builtin__
lib/python/ZODB/tests/testPersistentList.py
View file @
09545b1d
...
@@ -209,6 +209,10 @@ class TestPList(unittest.TestCase):
...
@@ -209,6 +209,10 @@ class TestPList(unittest.TestCase):
u
.
extend
(
u2
)
u
.
extend
(
u2
)
eq
(
u
,
u1
+
u2
,
"u == u1 + u2"
)
eq
(
u
,
u1
+
u2
,
"u == u1 + u2"
)
def
checkBackwardCompat
(
self
):
# Verify that the sanest of the ZODB 3.2 dotted paths still works.
from
ZODB.PersistentList
import
PersistentList
as
oldPath
self
.
assert_
(
oldPath
is
PersistentList
)
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
TestPList
,
'check'
)
return
unittest
.
makeSuite
(
TestPList
,
'check'
)
...
...
lib/python/ZODB/tests/testPersistentMapping.py
View file @
09545b1d
...
@@ -53,7 +53,14 @@ class PMTests(unittest.TestCase):
...
@@ -53,7 +53,14 @@ class PMTests(unittest.TestCase):
self
.
assert_
(
hasattr
(
r
,
'data'
))
self
.
assert_
(
hasattr
(
r
,
'data'
))
self
.
assert_
(
not
hasattr
(
r
,
'_container'
))
self
.
assert_
(
not
hasattr
(
r
,
'_container'
))
def
checkNewPicklesAreSafe
(
self
):
# TODO: This test fails in ZODB 3.3a1. It's making some assumption(s)
# about pickles that aren't true. Hard to say when it stopped working,
# because this entire test suite hasn't been run for a long time, due to
# a mysterious "return None" at the start of the test_suite() function
# below. I noticed that when the new checkBackwardCompat() test wasn't
# getting run.
def
TODO_checkNewPicklesAreSafe
(
self
):
s
=
MappingStorage
()
s
=
MappingStorage
()
db
=
ZODB
.
DB
(
s
)
db
=
ZODB
.
DB
(
s
)
r
=
db
.
open
().
root
()
r
=
db
.
open
().
root
()
...
@@ -75,6 +82,13 @@ class PMTests(unittest.TestCase):
...
@@ -75,6 +82,13 @@ class PMTests(unittest.TestCase):
self
.
assert_
(
hasattr
(
inst
,
'_container'
))
self
.
assert_
(
hasattr
(
inst
,
'_container'
))
self
.
assert_
(
not
hasattr
(
inst
,
'data'
))
self
.
assert_
(
not
hasattr
(
inst
,
'data'
))
def
checkBackwardCompat
(
self
):
# Verify that the sanest of the ZODB 3.2 dotted paths still works.
from
persistent.mapping
import
PersistentMapping
as
newPath
from
ZODB.PersistentMapping
import
PersistentMapping
as
oldPath
self
.
assert_
(
oldPath
is
newPath
)
def
find_global
(
modulename
,
classname
):
def
find_global
(
modulename
,
classname
):
"""Helper for this test suite to get special PersistentMapping"""
"""Helper for this test suite to get special PersistentMapping"""
...
@@ -89,7 +103,6 @@ def find_global(modulename, classname):
...
@@ -89,7 +103,6 @@ def find_global(modulename, classname):
return
getattr
(
mod
,
classname
)
return
getattr
(
mod
,
classname
)
def
test_suite
():
def
test_suite
():
return
None
return
unittest
.
makeSuite
(
PMTests
,
'check'
)
return
unittest
.
makeSuite
(
PMTests
,
'check'
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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