Commit 5992ea61 authored by Julien Muchembled's avatar Julien Muchembled

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
parent 8b3b5cf4
......@@ -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,), {})
......
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