From 5992ea61dda737584e93dfa2e52d856a299a606e Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 7 Dec 2010 15:56:20 +0000 Subject: [PATCH] Prevent transaction.commit() from reloading ghost portal types Note this also fixes TestERP5Type.test_04_CategoryAccessors A shorter test case would be: def test(self): self.login() self.portal.portal_types.Person.foo = 0 self.portal.person_module.newContent(portal_type='Person') transaction.abort() self.portal.portal_types.Person.foo = 0 self.portal.portal_categories.region.newContent() self.portal.person_module.newContent(portal_type='Person') transaction.commit() # raise ConflictError without this fix (provided Person portal type does not have 'type_class' attribute at the beginning). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41203 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/dynamic/lazy_class.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/product/ERP5Type/dynamic/lazy_class.py b/product/ERP5Type/dynamic/lazy_class.py index b3628a9b58..b8eacfd29c 100644 --- a/product/ERP5Type/dynamic/lazy_class.py +++ b/product/ERP5Type/dynamic/lazy_class.py @@ -69,6 +69,9 @@ class GhostBaseMetaClass(ExtensionClass): cls.__getattribute__ = __getattribute__ cls.__init__ = __init__ cls.__doc__ = GhostBaseMetaClass.ghost_doc + # This prevents serialize (ZODB) from reloading the class during commit + # (which would even trigger migration, resulting in a ConflictError). + cls.__getnewargs__ = None InitGhostBase = GhostBaseMetaClass('InitGhostBase', (ERP5Base,), {}) -- 2.30.9