Commit b43b9f15 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Avoid masking exceptions as much as possible when loading a Component.

parent 6dcf26fb
master allow_login_change allow_login_change_differentiate_id_and_login allow_login_change_wip arnau arnau-kns arnau-kns-without-property-mapping auto_extend_select_list autoflake backup_erp5_workflow bk_erp5ish_actions_tool bk_sqlcatalog cache catalog_fulltext catalog_fulltext_old cedric cedriclen cedriclen-eos cherry-pick-4a8e045d clean_up_upgrader compact_title_no_reference credential_update_action datetimefield douglas_forum dream_distributor eos-dev erp5-component erp5-data-notebook erp5-forum erp5-preference erp5-release erp5-slapos-upgrade erp5-vifib erp5-vifib-cleanup erp5_calendar erp5_free_subscription erp5_workflow fix/accounting_period_constraint_vs_acquired_node fix/change_state_priority fix/login_validate_check_consistency for_testrunner_1 for_testrunner_2 formbox gabriel gabriel-fix-rounding-in-accounting-generation gabriel-fix-rounding-in-accounting-generation2 gadget-json-value improve_default_caching_policy_manager isDeletable item_tracking_graph_editor jerome-bt-reference-doc jerome-test jerome_events jerome_graph_editor_renderjs jerome_user_preference_time_zone jm/form-action-guard joblib-activity jupyter-jio-erp5 jupyter-notebook-storage kns mame-erp5_project-cleanup mame-test-stock-indexation mame-work master-erp5-test-result-scalability-rebase master_calendar_wip_patches master_calendar_wip_patches_extend_security master_no_guard_on_workflow_transition master_no_guard_on_workflow_transition_plus_calendar_wip_patchs mrp nexedi-erp5-jp no_longer_simulated_state officejs officejs_clean portal_callables portal_solver_process_security_configuration rebased_mrp reindex_calendar_after_change_calendar_exception renderjs-extension romain-fulltext scalability-master2-rebase scalability-rebase shop-box sms_more_than_140_characters strict_catalog syncml test_page testnode_software_link timezones tristan tristan-merge tristan-performance view-aggregated-amounts vivekpab_erp5webrenderjs_layoutconfig vivekpab_jabberclient vivekpab_renderjs_interfaces wenjie wenjie_branch xiaowu_newui erp5.util-0.4.46 erp5.util-0.4.44 erp5.util-0.4.43 erp5.util-0.4.41 erp5.util-0.4.40 erp5.util-0.4.37
No related merge requests found
...@@ -193,13 +193,23 @@ def generatePortalTypeClass(site, portal_type_name): ...@@ -193,13 +193,23 @@ 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) try:
except (ImportError, AttributeError): module = module_loader.load_module(module_fullname)
pass except ImportError, e:
LOG("ERP5Type.dynamic", WARNING,
"Could not load Component module '%s': %s" % (module_fullname, e))
else:
try:
klass = getattr(module, type_class)
except AttributeError:
LOG("ERP5Type.dynamic", WARNING,
"Could not get class '%s' in Component module '%s'" % \
(type_class,
module_fullname))
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)
......
...@@ -69,12 +69,10 @@ if 1: ...@@ -69,12 +69,10 @@ if 1:
from kw. from kw.
""" """
try: try:
f = getattr(__import__('erp5.component.extension.' + self._module, component_module = __import__('erp5.component.extension.' + self._module,
fromlist=['erp5.component.extension'], fromlist=['erp5.component.extension'],
level=0), level=0)
self._function) except ImportError:
except (ImportError, AttributeError):
import Globals # for data import Globals # for data
filePath = self.filepath() filePath = self.filepath()
...@@ -92,6 +90,9 @@ if 1: ...@@ -92,6 +90,9 @@ if 1:
self.reloadIfChanged() self.reloadIfChanged()
f = None f = None
else:
f = getattr(component_module, self._function)
_v_f = getattr(self, '_v_f', None) _v_f = getattr(self, '_v_f', None)
if not _v_f or (f and f is not _v_f): if not _v_f or (f and 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