Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope-container
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
Boxiang Sun
zope-container
Commits
ad6a6615
Commit
ad6a6615
authored
Feb 25, 2013
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore Folder pickle forward/backward compatibility with 3.12.0
parent
88e2eeea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
CHANGES.txt
CHANGES.txt
+4
-3
src/zope/container/folder.py
src/zope/container/folder.py
+14
-2
src/zope/container/tests/test_folder.py
src/zope/container/tests/test_folder.py
+10
-1
No files found.
CHANGES.txt
View file @
ad6a6615
...
...
@@ -5,7 +5,8 @@ CHANGES
4.0.0a3 (unreleased)
--------------------
- Nothing changed yet.
- Restore ``Folder`` pickle forward/backward compatibility with
version 3.12.0 after making it inherit from ``BTreeContainer.``
4.0.0a2 (2013-02-21)
...
...
@@ -108,7 +109,7 @@ CHANGES
- Previous releases should be versioned 3.9.0 as they are not pure bugfix
releases and worth a "feature" release, increasing feature version.
Packages that depend on any changes introduced in version 3.8.2 or 3.8.3
should depend on version 3.9 or greater.
...
...
@@ -168,7 +169,7 @@ CHANGES
3.7.2 (2009-03-12)
------------------
- Fix: added missing ComponentLookupError, missing since revision 95429 and
- Fix: added missing ComponentLookupError, missing since revision 95429 and
missing in last release.
- Adapt to the move of IDefaultViewName from zope.component.interfaces
...
...
src/zope/container/folder.py
View file @
ad6a6615
...
...
@@ -21,8 +21,8 @@ from zope.container import btree, interfaces
class
Folder
(
btree
.
BTreeContainer
):
"""The standard Zope Folder implementation."""
# BBB: The data attribute used to be exposed.
This should make it also
#
compatible with old pickles.
# BBB: The data attribute used to be exposed.
#
For compatibility with existing pickles, we read and write that name
@
property
def
data
(
self
):
return
self
.
_SampleContainer__data
...
...
@@ -30,3 +30,15 @@ class Folder(btree.BTreeContainer):
@
data
.
setter
def
data
(
self
,
value
):
self
.
_SampleContainer__data
=
value
def
__getstate__
(
self
):
state
=
super
(
Folder
,
self
).
__getstate__
()
data
=
state
.
pop
(
'_SampleContainer__data'
)
state
[
'data'
]
=
data
return
state
def
__setstate__
(
self
,
state
):
if
'data'
in
state
and
'_SampleContainer__data'
not
in
state
:
state
[
'_SampleContainer__data'
]
=
state
.
pop
(
'data'
)
super
(
Folder
,
self
).
__setstate__
(
state
)
src/zope/container/tests/test_folder.py
View file @
ad6a6615
...
...
@@ -3,6 +3,7 @@ from unittest import TestCase, makeSuite
from
zope.container.folder
import
Folder
from
zope.container.tests.test_icontainer
import
TestSampleContainer
import
pickle
class
Test
(
TestSampleContainer
,
TestCase
):
...
...
@@ -15,6 +16,14 @@ class Test(TestSampleContainer, TestCase):
folder
.
data
=
'foo'
self
.
assertEqual
(
folder
.
data
,
'foo'
)
def
testPickleCompatibility
(
self
):
folder
=
self
.
makeTestObject
()
folder
[
'a'
]
=
1
self
.
assertEqual
(
folder
.
__getstate__
()[
'data'
],
folder
.
_SampleContainer__data
)
folder_clone
=
pickle
.
loads
(
pickle
.
dumps
(
folder
)
)
self
.
assertEqual
(
folder_clone
[
'a'
],
folder
[
'a'
]
)
def
test_suite
():
return
makeSuite
(
Test
)
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