Commit ebeb7cb4 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type.mixin.component: Avoid acquiring workflow_history.

workflow_history attribute may not exist on bootstrapping (constructInstance),
which could lead to acquisition, which could have further side-effects
as this is called during dynamic class initialisation.
Also, original code from CMFCore.WorkflowTool, from which this code is
derived for bootstrap reasons, does the equivalent aq_base, so follow
the same pattern.
parent 6bbe51d8
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
from __future__ import absolute_import from __future__ import absolute_import
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5.mixin.property_recordable import PropertyRecordableMixin from Products.ERP5.mixin.property_recordable import PropertyRecordableMixin
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
...@@ -198,7 +199,7 @@ class ComponentMixin(PropertyRecordableMixin, Base): ...@@ -198,7 +199,7 @@ class ComponentMixin(PropertyRecordableMixin, Base):
""" """
Needed for bootstrap when the WorkflowState Accessor is not defined yet Needed for bootstrap when the WorkflowState Accessor is not defined yet
""" """
return self.workflow_history[ return aq_base(self).workflow_history[
'component_validation_workflow'][-1]['validation_state'] 'component_validation_workflow'][-1]['validation_state']
security.declareProtected(Permissions.ModifyPortalContent, 'checkConsistency') security.declareProtected(Permissions.ModifyPortalContent, 'checkConsistency')
......
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