[CMF-checkins] CVS: Products/CMFCore/tests -
test_DirectoryView.py:1.19.10.2
Jens Vagelpohl
jens at dataflake.org
Mon Mar 7 18:02:40 EST 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv11664/CMFCore/tests
Modified Files:
Tag: CMF-1_5-branch
test_DirectoryView.py
Log Message:
- CMFCore.DirectoryView: A special __setattr__ on the
DirectoryViewSurrogate class made sure to write changes through to the
underlying DirectoryView, but there was no equivalent __delattr__
cleanup. (http://www.zope.org/Collectors/CMF/316)
=== Products/CMFCore/tests/test_DirectoryView.py 1.19.10.1 => 1.19.10.2 ===
--- Products/CMFCore/tests/test_DirectoryView.py:1.19.10.1 Wed Nov 24 10:26:06 2004
+++ Products/CMFCore/tests/test_DirectoryView.py Mon Mar 7 18:02:40 2005
@@ -148,6 +148,31 @@
# Test that the .test1.py is ignored
assert('#test1' not in self.ob.fake_skin.objectIds())
+ def test_surrogate_writethrough(self):
+ # CMF Collector 316: It is possible to cause ZODB writes because
+ # setting attributes on the non-persistent surrogate writes them
+ # into the persistent DirectoryView as well. This is bad in situations
+ # where you only want to store markers and remove them before the
+ # transaction has ended - they never got removed because there was
+ # no equivalent __delattr__ on the surrogate that would clean up
+ # the persistent DirectoryView as well.
+ fs = self.ob.fake_skin
+ test_foo = 'My Foovalue'
+ fs.foo = test_foo
+
+ self.assertEqual(fs.foo, test_foo)
+ self.assertEqual(fs.__dict__['_real'].foo, test_foo)
+
+ del fs.foo
+
+ self.assertRaises(AttributeError, getattr, fs, 'foo')
+ self.assertRaises( AttributeError
+ , getattr
+ , fs.__dict__['_real']
+ , 'foo'
+ )
+
+
if DevelopmentMode:
class DebugModeTests( FSDVTest ):
More information about the CMF-checkins
mailing list