Skip to content

Draft: Fix portal type class loading after Connection.resetCaches

Rafael Monnerat requested to merge rafael/erp5:fix-erp5-dynamic into master

When Connection.resetCaches is called, synchronizeDynamicModules clears all accessor holders, ghosting all portal type classes including Component Tool and Types Tool. This creates a circular dependency because the PEP 302 import hook depends on portal_components, and loading any tool class requires ComponentTool and TypesTool which are still ghosted. Fix by explicitly loadClass() on Component Tool and Types Tool after accessor holder clearance and adding a filesystem import fallback for Tool portal types in generatePortalTypeClass. Also fix ModuleNotFoundError for erp5.component.* sub-modules in ComponentMetaPathFinder.find_module and find_spec which incorrectly short-circuited component resolution when a non-empty path was present. Protect the generating flag with try/finally and skip broken property definitions in getAccessorHolderList.

For context, this was found because slapos master tests were broken to save/load because business templates were installed via configurator.

Merge request reports