From bae6775235d46146d03a01e359e4bf979e09cb9f Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Tue, 21 Mar 2006 23:03:49 +0000 Subject: [PATCH] Rename TransactionCache to ReadOnlyTransactionCache, because several people misunderstood the purpose. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6164 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/CMFCategory/CategoryTool.py | 8 ++++---- product/ERP5Type/Base.py | 4 ++-- product/ERP5Type/Cache.py | 12 ++++++------ product/ZSQLCatalog/SQLCatalog.py | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/product/CMFCategory/CategoryTool.py b/product/CMFCategory/CategoryTool.py index a49717720a..7e63231a05 100755 --- a/product/CMFCategory/CategoryTool.py +++ b/product/CMFCategory/CategoryTool.py @@ -37,7 +37,7 @@ from AccessControl import ClassSecurityInfo from Acquisition import aq_base from Products.ERP5Type import Permissions from Products.ERP5Type.Base import Base -from Products.ERP5Type.Cache import getTransactionCache +from Products.ERP5Type.Cache import getReadOnlyTransactionCache from Products.CMFCategory import _dtmldir from Products.CMFCore.PortalFolder import ContentFilter from Products.CMFCategory.Renderer import Renderer @@ -199,7 +199,7 @@ class CategoryTool( UniqueObject, Folder, Base ): Returns a Category object from a given category url and optionnal base category id """ - cache = getTransactionCache(self) + cache = getReadOnlyTransactionCache(self) if cache is not None: key = ('getCategoryValue', relative_url, base_category) try: @@ -766,7 +766,7 @@ class CategoryTool( UniqueObject, Folder, Base ): 'getSingleCategoryAcquiredMembershipList' ) def getSingleCategoryAcquiredMembershipList(self, context, base_category, base=0, spec=(), filter=None, acquired_object_dict = None, **kw ): - cache = getTransactionCache(self) + cache = getReadOnlyTransactionCache(self) if cache is not None: key = ('getSingleCategoryAcquiredMembershipList', context._p_oid, base_category, base, spec, filter, str(kw)) @@ -1399,7 +1399,7 @@ class CategoryTool( UniqueObject, Folder, Base ): Finds an object from a relative_url Method is public since we use restrictedTraverse """ - cache = getTransactionCache(self) + cache = getReadOnlyTransactionCache(self) if cache is not None: key = ('resolveCategory', relative_url) try: diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index e180cae645..621dc6fb17 100755 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -48,7 +48,7 @@ from Products.ERP5Type.Utils2 import _getListFor from Products.ERP5Type.Accessor.TypeDefinition import list_types from Products.ERP5Type.Accessor import Base as BaseAccessor from Products.ERP5Type.XMLExportImport import Base_asXML -from Products.ERP5Type.Cache import CachingMethod, clearCache, getTransactionCache +from Products.ERP5Type.Cache import CachingMethod, clearCache, getReadOnlyTransactionCache from Products.CMFCore.WorkflowCore import ObjectDeleted from Accessor import WorkflowState @@ -1224,7 +1224,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): """ Returns the portal object """ - cache = getTransactionCache(self) + cache = getReadOnlyTransactionCache(self) if cache is not None: key = 'getPortalObject' try: diff --git a/product/ERP5Type/Cache.py b/product/ERP5Type/Cache.py index 5028a71a5d..af5423c7a8 100755 --- a/product/ERP5Type/Cache.py +++ b/product/ERP5Type/Cache.py @@ -153,20 +153,20 @@ def clearCache(): # TransactionCache is a cache per transaction. The purpose of this cache is # to accelerate some heavy read-only operations. Note that this must not be # enabled when a trasaction may modify ZODB objects. -def getTransactionCache(context): +def getReadOnlyTransactionCache(context): """Get the transaction cache. """ try: - return context.REQUEST['_erp5_transaction_cache'] + return context.REQUEST['_erp5_read_only_transaction_cache'] except KeyError: return None -def enableTransactionCache(context): +def enableReadOnlyTransactionCache(context): """Enable the transaction cache. """ - context.REQUEST.set('_erp5_transaction_cache', {}) + context.REQUEST.set('_erp5_read_only_transaction_cache', {}) -def disableTransactionCache(context): +def disableReadOnlyTransactionCache(context): """Disable the transaction cache. """ - context.REQUEST.set('_erp5_transaction_cache', None) + context.REQUEST.set('_erp5_read_only_transaction_cache', None) diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index f6cf1418d2..65620cc0ef 100755 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -59,12 +59,12 @@ except ImportError: psyco = None try: - from Products.ERP5Type.Cache import enableTransactionCache, disableTransactionCache + from Products.ERP5Type.Cache import enableReadOnlyTransactionCache, disableReadOnlyTransactionCache except ImportError: def doNothing(context): pass - enableTransactionCache = doNothing - disableTransactionCache = doNothing + enableReadOnlyTransactionCache = doNothing + disableReadOnlyTransactionCache = doNothing UID_BUFFER_SIZE = 300 @@ -1047,7 +1047,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): try: if not disable_cache: - enableTransactionCache(self) + enableReadOnlyTransactionCache(self) method_kw_dict = {} for method_name in method_id_list: @@ -1135,7 +1135,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): raise finally: if not disable_cache: - disableTransactionCache(self) + disableReadOnlyTransactionCache(self) if psyco is not None: psyco.bind(catalogObjectList) -- 2.30.9