Commit f675c0fb authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: List of migratable 'Module Components' in Products.XXX.*...

ZODB Components: List of migratable 'Module Components' in Products.XXX.* should include any kind of objects and not only modules.

This fixes Products.ERP5VCS.Git module not being displayed because
Products.ERP5VCS.__init__ only imports one of its class and not the whole
module (and the module was not imported anywhere else too) so it was not in
Products.ERP5VCS.__dict__.
parent bd14f3a6
Pipeline #6264 canceled with stage
in 0 seconds
......@@ -6512,21 +6512,40 @@ Business Template is a set of definitions, such as skins, portal types and categ
if product_base_path is None:
continue
seen_module_set = set()
# 'Module Component': Only handle Product top-level modules
for submodule_name, submodule_obj in inspect.getmembers(product_obj,
inspect.ismodule):
if (submodule_name[0] == '_' or
submodule_name in ('this_module', 'Permissions')):
for name, obj in inspect.getmembers(product_obj):
if (name[0] == '_' or
name in ('this_module', 'Permissions') or
obj is product_obj):
continue
if inspect.ismodule(obj):
source_reference = obj.__name__
submodule_name = name
else:
try:
source_reference = obj.__module__
except AttributeError:
continue
try:
submodule_name = source_reference.rsplit('.', 1)[1]
except IndexError:
continue
if (source_reference == product_obj.__name__ or
not source_reference.startswith(product_obj.__name__) or
source_reference in seen_module_set):
continue
seen_module_set.add(source_reference)
try:
submodule_filepath = inspect.getsourcefile(submodule_obj)
submodule_filepath = inspect.getsourcefile(obj)
except TypeError:
# No file, builtin?
continue
if submodule_filepath and submodule_filepath.rsplit('/', 1)[0] == product_base_path:
source_reference = submodule_obj.__name__
migrate = submodule_filepath in portal_type_module_filepath_set
obj = __newTempComponent(portal_type='Module Component',
reference=submodule_name,
......
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