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
a211c624
Commit
a211c624
authored
May 15, 2009
by
Paul Carduner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a really nasty bug in OrderedContainer that occurs with duplication errors (now key errors).
parent
2722d446
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
CHANGES.txt
CHANGES.txt
+3
-0
src/zope/container/ordered.py
src/zope/container/ordered.py
+9
-1
No files found.
CHANGES.txt
View file @
a211c624
...
...
@@ -4,6 +4,9 @@ CHANGES
3.8.2 (unreleased)
------------------
- Fix a bug in OrderedContainer where trying to set the value for a
key that already exists (duplication error) would actually delete the
key from the order, leaving a dangling reference.
- Partially break dependency on ``zope.traversing`` by disusing
zope.traversing.api.getPath in favor of using
...
...
src/zope/container/ordered.py
View file @
a211c624
...
...
@@ -179,6 +179,13 @@ class OrderedContainer(Persistent, Contained):
['foo', 'baz']
>>> int(len(oc._order) == len(oc._data))
1
>>> oc['foo'] = 'baz'
Traceback (most recent call last):
...
KeyError: u'foo'
>>> oc._order
['foo', 'baz']
"""
existed
=
self
.
_data
.
has_key
(
key
)
...
...
@@ -207,7 +214,8 @@ class OrderedContainer(Persistent, Contained):
try
:
setitem
(
self
,
self
.
_data
.
__setitem__
,
key
,
object
)
except
Exception
,
e
:
self
.
_order
.
remove
(
key
)
if
not
existed
:
self
.
_order
.
remove
(
key
)
raise
e
return
key
...
...
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