Commit 642031a6 authored by Paul Carduner's avatar Paul Carduner

back port the change in trunk from r99988 to this branch.

parent d8b7f92a
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
CHANGES CHANGES
======= =======
3.7.0.1 (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.
3.7.0 (2009-01-31) 3.7.0 (2009-01-31)
------------------ ------------------
......
[buildout] [buildout]
extends = http://download.zope.org/zope3.4/3.4.0/versions.cfg
develop = . develop = .
/home/wosc/gocept/grok/sprint/zope.app.broken parts = test graph
/home/wosc/gocept/grok/sprint/zope.testing
/home/wosc/gocept/grok/compattest
parts = test graph compat
versions = versions versions = versions
[versions] [versions]
ZODB3 = 3.8 ZODB3 = 3.8
zope.app.apidoc = 3.5 zope.app.apidoc = 3.5
zope.app.container = 3.7.0
[test] [test]
recipe = zc.recipe.testrunner recipe = zc.recipe.testrunner
...@@ -17,10 +16,4 @@ eggs = zope.container ...@@ -17,10 +16,4 @@ eggs = zope.container
[graph] [graph]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ${test:eggs} eggs = ${test:eggs}
tl.eggdeps tl.eggdeps
\ No newline at end of file
[compat]
recipe = z3c.recipe.compattest
use_svn = true
svn_directory = /home/wosc/gocept/grok/sprint
max_jobs = 5
...@@ -22,7 +22,7 @@ def read(*rnames): ...@@ -22,7 +22,7 @@ def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read() return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
setup(name='zope.container', setup(name='zope.container',
version = '3.7.0', version = '3.7.0.1dev',
author='Zope Corporation and Contributors', author='Zope Corporation and Contributors',
author_email='zope-dev@zope.org', author_email='zope-dev@zope.org',
description='Zope Container', description='Zope Container',
......
...@@ -179,6 +179,13 @@ class OrderedContainer(Persistent, Contained): ...@@ -179,6 +179,13 @@ class OrderedContainer(Persistent, Contained):
['foo', 'baz'] ['foo', 'baz']
>>> int(len(oc._order) == len(oc._data)) >>> int(len(oc._order) == len(oc._data))
1 1
>>> oc['foo'] = 'baz'
Traceback (most recent call last):
...
DuplicationError: foo
>>> oc._order
['foo', 'baz']
""" """
existed = self._data.has_key(key) existed = self._data.has_key(key)
...@@ -207,7 +214,8 @@ class OrderedContainer(Persistent, Contained): ...@@ -207,7 +214,8 @@ class OrderedContainer(Persistent, Contained):
try: try:
setitem(self, self._data.__setitem__, key, object) setitem(self, self._data.__setitem__, key, object)
except Exception, e: except Exception, e:
self._order.remove(key) if not existed:
self._order.remove(key)
raise e raise e
return key return key
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment