Commit 29a1b22f authored by Arnaud Fontaine's avatar Arnaud Fontaine

Mixins not already imported were not available in Portal Type UI (#20140326-1A7D11).

Instead of inspecting the content of mixin modules, which relies on already
imported module, use the same approach as Document (updateGlobals()), eg using
FS path so that even modules not already beforehand are not ignored.
parent f8d9952f
......@@ -88,10 +88,6 @@ portal_tools = ( CategoryTool.CategoryTool,
content_classes = ()
content_constructors = ()
# XXX-AUREL : see bug #20140326-1A7D11
from mixin import periodicity
# Finish installation
def initialize( context ):
import Document
......
......@@ -1111,11 +1111,14 @@ def initializeProduct( context,
mixin_module = getattr(this_module, 'mixin', None)
if mixin_module is not None:
from Products.ERP5Type import mixin_class_registry
for k, submodule in inspect.getmembers(mixin_module, inspect.ismodule):
import importlib
path, module_id_list = getModuleIdList(package_home(this_module.__dict__), 'mixin')
for module_id in module_id_list:
submodule = importlib.import_module('%s.%s' % (mixin_module.__name__, module_id))
for klassname, klass in inspect.getmembers(submodule, inspect.isclass):
# only classes defined here
if 'mixin' in klass.__module__ and not issubclass(klass, Exception):
classpath = '.'.join((module_name, 'mixin', k, klassname))
classpath = '.'.join((module_name, 'mixin', module_id, klassname))
mixin_class_registry[klassname] = classpath
product_name = module_name.split('.')[-1]
......
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