diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index b39131a6e4e9006490e7a5610451a1e048629379..376f7455a4c181f3ffa9c92e6481d506267c8d7f 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -5496,7 +5496,13 @@ Business Template is a set of definitions, such as skins, portal types and categ site.ERP5Site_updateTranslationTable() # Clear cache to avoid reusing cached values with replaced objects. - site.portal_caches.clearAllCache() + try: + cache_tool = site.portal_caches + except AttributeError: + # Only happen when installing erp5_core shipping portal_caches + pass + else: + cache_tool.clearAllCache() security.declareProtected(Permissions.ManagePortal, 'install') install = _install diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index 643fd0db9b813cefba038a73592cd35c96036deb..b6c61af90d6e4dc1f655d45273e8e92688f664dc 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -2093,7 +2093,6 @@ class ERP5Generator(PortalGenerator): addERP5Tool(p, 'portal_alarms', 'Alarm Tool') # Add ERP5Type Tool - addERP5Tool(p, 'portal_caches', 'Cache Tool') addERP5Tool(p, 'portal_memcached', 'Memcached Tool') # Add erp5 catalog tool diff --git a/product/ERP5Type/Tool/CacheTool.py b/product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.py similarity index 97% rename from product/ERP5Type/Tool/CacheTool.py rename to product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.py index 74ea0af91295529e5ad14815ba45f329b2ec2441..6d6a061018273f203289629f9f54b79e1ab8e829 100644 --- a/product/ERP5Type/Tool/CacheTool.py +++ b/product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.py @@ -33,7 +33,7 @@ import transaction from AccessControl import ClassSecurityInfo from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type import Permissions -from Products.ERP5Type.Globals import InitializeClass, DTMLFile, PersistentMapping +from Products.ERP5Type.Globals import DTMLFile from Products.ERP5Type import _dtmldir from Products.ERP5Type.Cache import CacheFactory from Products.ERP5Type.Cache import CachingMethod @@ -69,9 +69,9 @@ class CacheTool(BaseTool): def getRamCachePlugin(cp): cp_meta_type = cp.meta_type - id = cp.getCacheId() + id_ = cp.getCacheId() if cp_meta_type == 'ERP5 Ram Cache': - return RamCache(id) + return RamCache(id_) if cp_meta_type == 'ERP5 Distributed Ram Cache': ## even thougn we have such plugin in ZODB that doens't mean ## we have corresponding memcache module installed @@ -85,7 +85,7 @@ class CacheTool(BaseTool): 'server_max_key_length': memcached_plugin.getServerMaxKeyLength(), 'server_max_value_length': memcached_plugin.getServerMaxValueLength(), 'key_prefix': getattr(self, 'erp5_site_global_id', '')} - return DistributedRamCache(id, init_dict) + return DistributedRamCache(id_, init_dict) rd = {} for cf in self.objectValues('ERP5 Cache Factory'): @@ -184,7 +184,6 @@ class CacheTool(BaseTool): assert REQUEST is None transaction.get().addBeforeCommitHook(self.clearCache, (cache_factory_list,)) - ram_cache_root = self.getRamCacheRoot() for cf_key in cache_factory_list: self.clearCacheFactory(cf_key) if REQUEST is not None: diff --git a/product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.xml b/product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.xml new file mode 100644 index 0000000000000000000000000000000000000000..dbca2b0ca259210f59e868999b5993a94a96899e --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.CacheTool.xml @@ -0,0 +1,110 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Tool Component" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>default_reference</string> </key> + <value> <string>CacheTool</string> </value> + </item> + <item> + <key> <string>default_source_reference</string> </key> + <value> <string>Products.ERP5Type.Tool.CacheTool</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>tool.erp5.CacheTool</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Tool Component</string> </value> + </item> + <item> + <key> <string>sid</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>text_content_error_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>text_content_warning_message</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>erp5</string> </value> + </item> + <item> + <key> <string>workflow_history</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>component_validation_workflow</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_log</string> </key> + <value> + <list> + <dictionary> + <item> + <key> <string>action</string> </key> + <value> <string>validate</string> </value> + </item> + <item> + <key> <string>validation_state</string> </key> + <value> <string>validated</string> </value> + </item> + </dictionary> + </list> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml b/product/ERP5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml new file mode 100644 index 0000000000000000000000000000000000000000..0d01e64b4ea8e489acf0fd6d5bfd4cacf0826e18 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/ToolTemplateItem/portal_caches.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Cache Tool" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>portal_caches</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list b/product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list index 07e43f184d581a33f27f570064a63ec6cb6cb54b..92fe75834560dadcf95e3998a62fd23f51d4ffec 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list +++ b/product/ERP5/bootstrap/erp5_core/bt/template_tool_component_id_list @@ -1,5 +1,6 @@ tool.erp5.AcknowledgementTool tool.erp5.BuilderTool +tool.erp5.CacheTool tool.erp5.CallableTool tool.erp5.ContributionRegistryTool tool.erp5.DeliveryTool diff --git a/product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list b/product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list index ec3fdb76f546942298f0ad332a570dc49b13dc32..42e13641d8e75a30eb354a15a903c7a9561c3d4a 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list +++ b/product/ERP5/bootstrap/erp5_core/bt/template_tool_id_list @@ -1,5 +1,6 @@ mimetypes_registry portal_acknowledgements +portal_caches portal_callables portal_contribution_registry portal_deliveries diff --git a/product/ERP5Type/__init__.py b/product/ERP5Type/__init__.py index 6d06c36126f2f3fec18d2fdb57082918ccc7cf4d..5a8de256454e4372b6bb465cc766b04213a7a739 100644 --- a/product/ERP5Type/__init__.py +++ b/product/ERP5Type/__init__.py @@ -88,7 +88,7 @@ import Products.ERP5Type.Workflow def initialize( context ): # Import Product Components - from Tool import (CacheTool, MemcachedTool, + from Tool import (MemcachedTool, TypesTool, WebServiceTool, PropertySheetTool, ComponentTool) import Document @@ -102,8 +102,7 @@ def initialize( context ): content_classes = ( Base, XMLObject.XMLObject, ERP5TypeInformation, ) - portal_tools = ( CacheTool.CacheTool, - MemcachedTool.MemcachedTool, + portal_tools = ( MemcachedTool.MemcachedTool, TypesTool.TypesTool, WebServiceTool.WebServiceTool, PropertySheetTool.PropertySheetTool,