diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/addToRegistry.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/addToRegistry.xml deleted file mode 100644 index fac39236089aa308d214c83fb213046ea1cf1101..0000000000000000000000000000000000000000 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/addToRegistry.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>state_change[\'object\'].addToRegistry()\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>addToRegistry</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/deleteFromRegistry.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/deleteFromRegistry.xml deleted file mode 100644 index 1fd6eccca7e6f6d119e9f39bf4b31923979573ed..0000000000000000000000000000000000000000 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/scripts/deleteFromRegistry.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string>state_change[\'object\'].deleteFromRegistry()\n -</string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string>state_change</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>deleteFromRegistry</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate.xml index c079f7e361b080d922fc2ba3b112a7f5a9c15ca6..1eea221d8e91767d88ad05a69f291a77a8451457 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/invalidate.xml @@ -46,7 +46,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string>deleteFromRegistry</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate.xml index 61869caf5c8468b6cce3d385f93a4ef659cefc4a..605cea001572c21ba42b686d6e1dbfb0b7f33ca1 100644 --- a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate.xml +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/component_validation_workflow/transitions/validate.xml @@ -46,7 +46,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string>addToRegistry</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log index 05e25c7174ff272aa44ac38f78511e4c2f41d9fa..7f88fcb8677cfce63d6e35aece2eff0b149a16dc 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/change_log +++ b/product/ERP5/bootstrap/erp5_core/bt/change_log @@ -1,3 +1,6 @@ +2012-02-21 arnaud.fontaine +* Do not update automatically the component module registry for reliability's sake. + 2012-02-20 arnaud.fontaine * Add Business Template action to import Document and Extensions automatically after giving the version. diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index d44e67a8035860f229ae8888c7add5854a1b05be..65466d150156200359b42463d3b566e0c90104d7 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41003 \ No newline at end of file +41004 \ No newline at end of file diff --git a/product/ERP5Type/Core/Component.py b/product/ERP5Type/Core/Component.py index ea00636eb076d5e4e4e779755fb2f391a216e3d5..cf7e3c0c4569eb1dcd0aa25543547abfd9bcf162 100644 --- a/product/ERP5Type/Core/Component.py +++ b/product/ERP5Type/Core/Component.py @@ -98,31 +98,6 @@ class Component(Base): return [] - security.declareProtected(Permissions.ModifyPortalContent, 'addToRegistry') - def addToRegistry(self): - """ - Add the Component to its appropriate module registry - """ - namespace_fullname = self._getDynamicModuleNamespace() - namespace_module = __import__(namespace_fullname, {}, {}, - fromlist=[namespace_fullname]) - - reference = self.getReference() - namespace_module._registry_dict.setdefault( - reference, {})[self.getVersion()] = self - - security.declareProtected(Permissions.ModifyPortalContent, - 'deleteFromRegistry') - def deleteFromRegistry(self): - """ - Delete the Component from its appropriate module registry - """ - namespace_fullname = self._getDynamicModuleNamespace() - namespace_module = __import__(namespace_fullname, {}, {}, - fromlist=[namespace_fullname]) - - del namespace_module._registry_dict[self.getReference()] - def _setTextContent(self, text_content): """ When the validation state is already 'validated', set the new value to diff --git a/product/ERP5Type/Tool/ComponentTool.py b/product/ERP5Type/Tool/ComponentTool.py index 8612f3a79dd4c59b97b92b4ca806f7aaf58839e0..a04753ae3595d22196ad187b99ccdfad42526c12 100644 --- a/product/ERP5Type/Tool/ComponentTool.py +++ b/product/ERP5Type/Tool/ComponentTool.py @@ -112,6 +112,7 @@ class ComponentTool(BaseTool): except AttributeError: pass else: + module._resetRegistry() self._resetModule(module) type_tool.resetDynamicDocumentsOnceAtTransactionBoundary() diff --git a/product/ERP5Type/dynamic/component_class.py b/product/ERP5Type/dynamic/component_class.py index 8730ec17779ae0b25377fa984830835ea6f0b6ec..262e68f755660b17a1811ec88be235b37e1755ee 100644 --- a/product/ERP5Type/dynamic/component_class.py +++ b/product/ERP5Type/dynamic/component_class.py @@ -64,7 +64,7 @@ class ComponentDynamicPackage(ModuleType): # Necessary otherwise imports will fail because an object is considered a # package only if __path__ is defined __path__ = [] - __registry_dict = None + __registry_dict = {} def __init__(self, namespace, portal_type): super(ComponentDynamicPackage, self).__init__(namespace) @@ -93,7 +93,7 @@ class ComponentDynamicPackage(ModuleType): like erp5.component.extension.VERSION.REFERENCE perhaps but there should be a a way to specify priorities such as portal_skins maybe? """ - if self.__registry_dict is None: + if not self.__registry_dict: try: component_tool = getSite().portal_components # XXX-arnau: When installing ERP5 site, erp5_core_components has not @@ -117,6 +117,9 @@ class ComponentDynamicPackage(ModuleType): return self.__registry_dict + def _resetRegistry(self): + self.__registry_dict.clear() + def find_module(self, fullname, path=None): # Ignore imports with a path which are filesystem-only and any # absolute imports which does not start with this package prefix,