[Zope3-checkins] SVN: Zope3/trunk/ Bug Fixes
Jim Fulton
jim at zope.com
Thu Jul 28 12:26:49 EDT 2005
Log message for revision 37532:
Bug Fixes
- Container proxy instances had __dict__ attributes that hid
the __dict__ attributes of proxied objects.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/app/container/contained.py
U Zope3/trunk/src/zope/app/container/tests/test_contained.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-07-28 14:02:49 UTC (rev 37531)
+++ Zope3/trunk/doc/CHANGES.txt 2005-07-28 16:26:49 UTC (rev 37532)
@@ -655,6 +655,9 @@
Bug Fixes
+ - Container proxy instances had __dict__ attributes that hid
+ the __dict__ attributes of proxied objects.
+
- Fix #284: Bogus 404 errors with TALES traversal fails
- Fix #298: Role/permission title and description should be messageids
Modified: Zope3/trunk/src/zope/app/container/contained.py
===================================================================
--- Zope3/trunk/src/zope/app/container/contained.py 2005-07-28 14:02:49 UTC (rev 37531)
+++ Zope3/trunk/src/zope/app/container/contained.py 2005-07-28 16:26:49 UTC (rev 37532)
@@ -837,6 +837,9 @@
class ContainedProxy(ContainedProxyBase):
+ # Prevent proxies from having their own instance dictionaries:
+ __slots__ = ()
+
__safe_for_unpickling__ = True
zope.interface.implements(IContained)
Modified: Zope3/trunk/src/zope/app/container/tests/test_contained.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_contained.py 2005-07-28 14:02:49 UTC (rev 37531)
+++ Zope3/trunk/src/zope/app/container/tests/test_contained.py 2005-07-28 16:26:49 UTC (rev 37532)
@@ -290,7 +290,32 @@
"""
+def test_ContainedProxy_instances_have_no_instance_dictionaries():
+ """Make sure that proxies don't introduce extra instance dictionaries
+ >>> from zope.app.container.contained import ContainedProxy
+ >>> class C:
+ ... pass
+
+ >>> c = C()
+ >>> c.x = 1
+ >>> c.__dict__
+ {'x': 1}
+
+ >>> p = ContainedProxy(c)
+ >>> p.__dict__
+ {'x': 1}
+ >>> p.y = 3
+ >>> p.__dict__
+ {'y': 3, 'x': 1}
+ >>> c.__dict__
+ {'y': 3, 'x': 1}
+
+ >>> p.__dict__ is c.__dict__
+ True
+
+ """
+
def test_suite():
return unittest.TestSuite((
doctest.DocTestSuite('zope.app.container.contained',
More information about the Zope3-Checkins
mailing list