Commit 464dfa55 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Make sure that objects created on bootstrap are committed before trying to load them from ZODB.

Because of recently added Component Tool, POSKeyError exception was raised
when trying to load it from ZODB during migration of Portal Type classes and
ZODB Property Sheets (PickleUpdater() in ERP5Site.migrateToPortalTypeClass),
so make sure that there is a commit before loading anything from ZODB.
...@@ -44,6 +44,7 @@ from zLOG import LOG, INFO, WARNING, ERROR ...@@ -44,6 +44,7 @@ from zLOG import LOG, INFO, WARNING, ERROR
from string import join from string import join
import os import os
import warnings import warnings
import transaction
from App.config import getConfiguration from App.config import getConfiguration
MARKER = [] MARKER = []
...@@ -1608,6 +1609,10 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin): ...@@ -1608,6 +1609,10 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
security.declareProtected(Permissions.ManagePortal, security.declareProtected(Permissions.ManagePortal,
'migrateToPortalTypeClass') 'migrateToPortalTypeClass')
def migrateToPortalTypeClass(self): def migrateToPortalTypeClass(self):
# PickleUpdater() will load objects from ZODB, but any objects created
# before must have been committed (otherwise POSKeyError is raised)
transaction.savepoint(optimistic=True)
from Products.ERP5Type.dynamic.persistent_migration import PickleUpdater from Products.ERP5Type.dynamic.persistent_migration import PickleUpdater
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
PickleUpdater(self) PickleUpdater(self)
......
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