[CMF-checkins] CVS: Products/CMFCore/tests -
test_DirectoryView.py:1.23
Jens Vagelpohl
jens at dataflake.org
Mon Mar 7 18:03:05 EST 2005
Update of /cvs-repository/Products/CMFCore/tests
In directory cvs.zope.org:/tmp/cvs-serv11745/CMFCore/tests
Modified Files:
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.22 => 1.23 ===
--- Products/CMFCore/tests/test_DirectoryView.py:1.22 Sun Mar 6 07:29:03 2005
+++ Products/CMFCore/tests/test_DirectoryView.py Mon Mar 7 18:03:04 2005
@@ -158,6 +158,30 @@
# 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'
+ )
+
class DirectoryViewFolderTests(FSDVTest):
More information about the CMF-checkins
mailing list