Commit 12830504 authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Łukasz Nowak

Do not mask exceptions when loading a Component.

(cherry picked from commit 7af4728b7463a521fadca3dcedbd5e445d9ef12e)
parent 0566435f
...@@ -110,7 +110,13 @@ class ComponentDynamicPackage(ModuleType): ...@@ -110,7 +110,13 @@ class ComponentDynamicPackage(ModuleType):
# Only consider modified or validated states as state transition will # Only consider modified or validated states as state transition will
# be handled by component_validation_workflow which will take care of # be handled by component_validation_workflow which will take care of
# updating the registry # updating the registry
if component.getValidationState() in ('modified', 'validated'): try:
validation_state_tuple = component.getValidationState()
except AttributeError:
# XXX: Accessors may have not been generated yet
pass
if validation_state_tuple in ('modified', 'validated'):
version = component.getVersion(validated_only=True) version = component.getVersion(validated_only=True)
# The versions should have always been set on ERP5Site property # The versions should have always been set on ERP5Site property
# beforehand # beforehand
......
...@@ -193,13 +193,14 @@ def generatePortalTypeClass(site, portal_type_name): ...@@ -193,13 +193,14 @@ def generatePortalTypeClass(site, portal_type_name):
type_class_namespace = document_class_registry.get(type_class, '') type_class_namespace = document_class_registry.get(type_class, '')
if not (type_class_namespace.startswith('Products.ERP5Type') or if not (type_class_namespace.startswith('Products.ERP5Type') or
portal_type_name in core_portal_type_class_dict): portal_type_name in core_portal_type_class_dict):
try: import erp5.component.document
klass = getattr(__import__('erp5.component.document.' + type_class, module_fullname = 'erp5.component.document.' + type_class
fromlist=['erp5.component.document'], module_loader = erp5.component.document.find_module(module_fullname)
level=0), if module_loader is not None:
type_class) with Base.aq_method_lock:
except (ImportError, AttributeError): module = module_loader(module_fullname)
pass
klass = getattr(module, type_class)
if klass is None: if klass is None:
type_class_path = document_class_registry.get(type_class) type_class_path = document_class_registry.get(type_class)
......
...@@ -43,15 +43,18 @@ def __call__(self, *args, **kw): ...@@ -43,15 +43,18 @@ def __call__(self, *args, **kw):
Component Extension if available, otherwise fallback on filesystem Component Extension if available, otherwise fallback on filesystem
Extension Extension
""" """
try: import erp5.component.extension
f = getattr(__import__('erp5.component.extension.' + self._module, module_fullname = 'erp5.component.extension.' + self._module
fromlist=['erp5.component.extension'], module_loader = erp5.component.extension.find_module(module_fullname)
level=0),
self._function)
except (ImportError, AttributeError): if module_loader is None:
return ExternalMethod__call__(self, *args, **kw) return ExternalMethod__call__(self, *args, **kw)
else: else:
from Products.ERP5Type.Base import Base
with Base.aq_method_lock:
module = module_loader.load_module(module_fullname)
f = getattr(module, self._function)
_v_f = getattr(self, '_v_f', None) _v_f = getattr(self, '_v_f', None)
if not _v_f or f is not _v_f: if not _v_f or f is not _v_f:
f = self.getFunction(f=f) f = self.getFunction(f=f)
......
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