[Erp5-report] r38366 jm - in /erp5/trunk/products: CMFActivity/ CMFActivity/Activity/ ERP5/...

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Sep 14 15:55:59 CEST 2010


Author: jm
Date: Tue Sep 14 15:55:56 2010
New Revision: 38366

URL: http://svn.erp5.org?rev=38366&view=rev
Log:
Deprecate passing a parameter to getTransactionalVariable

getTransactionalVariable has always been implemented to return a global
cache object (1 per thread): old implementation used the given context only to
have access to the portal.

So we enforce this with a warning to make sure people don't expect retrieving
1 cache object per given context.

Modified:
    erp5/trunk/products/CMFActivity/ActiveObject.py
    erp5/trunk/products/CMFActivity/Activity/SQLBase.py
    erp5/trunk/products/CMFActivity/ActivityRuntimeEnvironment.py
    erp5/trunk/products/ERP5/Document/Amount.py
    erp5/trunk/products/ERP5/Document/AppliedRule.py
    erp5/trunk/products/ERP5/Document/BPMBuilder.py
    erp5/trunk/products/ERP5/Document/Document.py
    erp5/trunk/products/ERP5/Document/SimulationMovement.py
    erp5/trunk/products/ERP5/ERP5Site.py
    erp5/trunk/products/ERP5/mixin/cached_convertable.py
    erp5/trunk/products/ERP5/mixin/document.py
    erp5/trunk/products/ERP5Catalog/CatalogTool.py
    erp5/trunk/products/ERP5Form/PreferenceTool.py
    erp5/trunk/products/ERP5Form/ProxyField.py
    erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
    erp5/trunk/products/ERP5Type/Base.py
    erp5/trunk/products/ERP5Type/Cache.py
    erp5/trunk/products/ERP5Type/TransactionalVariable.py
    erp5/trunk/products/ERP5Type/Utils.py
    erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/CMFActivity/ActiveObject.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActiveObject.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/ActiveObject.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/ActiveObject.py [utf8] Tue Sep 14 15:55:56 2010
@@ -98,7 +98,7 @@ class ActiveObject(ExtensionClass.Base):
           kw[k] = v
 
     # Get default parameters from a transactional variable.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_activate_parameter', id(aq_base(self)))
     try:
       for k, v in tv[key].iteritems():
@@ -173,14 +173,14 @@ class ActiveObject(ExtensionClass.Base):
     # This method sets the default keyword parameters to activate. This is
     # useful when you need to specify special parameters implicitly (e.g. to
     # reindexObject).
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_activate_parameter', id(aq_base(self)))
     tv[key] = kw
 
   def getDefaultActivateParameterDict(self, inherit_placeless=True):
     # This method returns default activate parameters to self.
     # The result can be either a dict object or None.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     if inherit_placeless:
       placeless = tv.get(('default_activate_parameter', ))
       if placeless is not None:

Modified: erp5/trunk/products/CMFActivity/Activity/SQLBase.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLBase.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLBase.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLBase.py [utf8] Tue Sep 14 15:55:56 2010
@@ -322,7 +322,7 @@ class SQLBase:
       # So all connectors must be committed now that we have selected
       # everything needed from MySQL to get a fresh view of ZODB objects.
       transaction.commit()
-      tv = getTransactionalVariable(None)
+      tv = getTransactionalVariable()
       tv['activity_runtime_environment'] = activity_runtime_environment
       # Try to invoke
       try:

Modified: erp5/trunk/products/CMFActivity/ActivityRuntimeEnvironment.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/ActivityRuntimeEnvironment.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/ActivityRuntimeEnvironment.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/ActivityRuntimeEnvironment.py [utf8] Tue Sep 14 15:55:56 2010
@@ -4,7 +4,7 @@ def getActivityRuntimeEnvironment():
   """
     Raises KeyError if called outside activity.
   """
-  return getTransactionalVariable(None)['activity_runtime_environment']
+  return getTransactionalVariable()['activity_runtime_environment']
 
 def _getActivityRuntimeEnvironment():
   try:

Modified: erp5/trunk/products/ERP5/Document/Amount.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Amount.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Amount.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Amount.py [utf8] Tue Sep 14 15:55:56 2010
@@ -421,7 +421,7 @@ class Amount(Base, Variated):
     # Stop any recursive call to this method. This happens when a Path
     # does not have base unit price locally, so it looks it up, and
     # each path of a predicate list does the same again.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = '_getBaseUnitPrice'
     if key in tv:
       return

Modified: erp5/trunk/products/ERP5/Document/AppliedRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AppliedRule.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/AppliedRule.py [utf8] Tue Sep 14 15:55:56 2010
@@ -98,7 +98,7 @@ class AppliedRule(XMLObject):
         An applied rule can be expanded only if its parent movement
         is expanded.
       """
-      tv = getTransactionalVariable(self)
+      tv = getTransactionalVariable()
       cache = tv.setdefault(TREE_DELIVERED_CACHE_KEY, {})
       cache_enabled = cache.get(TREE_DELIVERED_CACHE_ENABLED, 0)
 
@@ -247,7 +247,7 @@ class AppliedRule(XMLObject):
 
       see SimulationMovement._isTreeDelivered
       """
-      tv = getTransactionalVariable(self)
+      tv = getTransactionalVariable()
       cache = tv.setdefault(TREE_DELIVERED_CACHE_KEY, {})
       cache_enabled = cache.get(TREE_DELIVERED_CACHE_ENABLED, 0)
 

Modified: erp5/trunk/products/ERP5/Document/BPMBuilder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BPMBuilder.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BPMBuilder.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BPMBuilder.py [utf8] Tue Sep 14 15:55:56 2010
@@ -762,16 +762,16 @@ class BPMBuilder(Alarm):
     return obj
 
   def _isUpdated(self, obj, level):
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     return level in tv['builder_processed_list'].get(obj, [])
 
   def _setUpdated(self, obj, level):
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     if tv.get('builder_processed_list', None) is None:
       self._resetUpdated()
     tv['builder_processed_list'][obj] = \
        tv['builder_processed_list'].get(obj, []) + [level]
 
   def _resetUpdated(self):
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     tv['builder_processed_list'] = {}

Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Tue Sep 14 15:55:56 2010
@@ -357,7 +357,7 @@ class Document(DocumentExtensibleTravers
       NOTE: passing a group_by parameter may be useful at a
       later stage of the implementation.
     """
-    tv = getTransactionalVariable(self) # XXX Performance improvement required
+    tv = getTransactionalVariable() # XXX Performance improvement required
     cache_key = ('getImplicitSuccessorValueList', self.getPhysicalPath())
     try:
       return tv[cache_key]

Modified: erp5/trunk/products/ERP5/Document/SimulationMovement.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/SimulationMovement.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/SimulationMovement.py [utf8] Tue Sep 14 15:55:56 2010
@@ -231,7 +231,7 @@ class SimulationMovement(Movement, Prope
     """
     portal_rules = getToolByName(self.getPortalObject(), 'portal_rules')
 
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     cache = tv.setdefault(TREE_DELIVERED_CACHE_KEY, {})
     cache_enabled = cache.get(TREE_DELIVERED_CACHE_ENABLED, 0)
 
@@ -520,7 +520,7 @@ class SimulationMovement(Movement, Prope
 
     see AppliedRule._isTreeDelivered
     """
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     cache = tv.setdefault(TREE_DELIVERED_CACHE_KEY, {})
     cache_enabled = cache.get(TREE_DELIVERED_CACHE_ENABLED, 0)
 

Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Tue Sep 14 15:55:56 2010
@@ -1278,7 +1278,7 @@ class ERP5Site(FolderMixIn, CMFSite):
     # This method sets the default keyword parameters to reindex. This is useful
     # when you need to specify special parameters implicitly (e.g. to reindexObject).
     # Those parameters will affect all reindex calls, not just ones on self.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_reindex_parameter', )
     tv[key] = kw
 
@@ -1287,7 +1287,7 @@ class ERP5Site(FolderMixIn, CMFSite):
     # This method sets the default keyword parameters to activate. This is useful
     # when you need to specify special parameters implicitly (e.g. to reindexObject).
     # Those parameters will affect all activate calls, not just ones on self.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_activate_parameter', )
     tv[key] = kw
 
@@ -1295,7 +1295,7 @@ class ERP5Site(FolderMixIn, CMFSite):
   def getPlacelessDefaultReindexParameters(self):
     # This method returns default reindex parameters to self.
     # The result can be either a dict object or None.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_reindex_parameter', )
     return tv.get(key)
 
@@ -1303,7 +1303,7 @@ class ERP5Site(FolderMixIn, CMFSite):
   def getPlacelessDefaultActivateParameters(self):
     # This method returns default activate parameters to self.
     # The result can be either a dict object or None.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_activate_parameter', )
     return tv.get(key)
 

Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Tue Sep 14 15:55:56 2010
@@ -157,7 +157,7 @@ class CachedConvertableMixin:
     cache_duration = cache_factory.cache_duration
     # The purpose of this transaction cache is to help calls
     # to the same cache value in the same transaction.
-    tv = getTransactionalVariable(None)
+    tv = getTransactionalVariable()
     tv[cache_id] = stored_data_dict
     for cache_plugin in cache_factory.getCachePluginList():
       cache_plugin.set(cache_id, DEFAULT_CACHE_SCOPE,
@@ -172,7 +172,7 @@ class CachedConvertableMixin:
       return getattr(aq_base(self), 'temp_conversion_data', {})[cache_id]
     # The purpose of this cache is to help calls to the same cache value
     # in the same transaction.
-    tv = getTransactionalVariable(None)
+    tv = getTransactionalVariable()
     try:
       return tv[cache_id]
     except KeyError:

Modified: erp5/trunk/products/ERP5/mixin/document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/document.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/document.py [utf8] Tue Sep 14 15:55:56 2010
@@ -61,7 +61,7 @@ class DocumentMixin:
       string (ex. jpeg, html, text, txt, etc.)
       **kw can be various things - e.g. resolution
     """
-    transaction_variable = getTransactionalVariable(self.getPortalObject())
+    transaction_variable = getTransactionalVariable()
     if LOCK_PERMISSION_KEY in transaction_variable:
       # in convert we want always to check conversion format permission
       # to bypass such check one should use _convert directly
@@ -95,7 +95,7 @@ class DocumentMixin:
     """Private method to check permission when access specified format.
     This method raises
     """
-    transaction_variable = getTransactionalVariable(self.getPortalObject())
+    transaction_variable = getTransactionalVariable()
     if transaction_variable.get(LOCK_PERMISSION_KEY, False):
       # Permission already checked in convert with final format,
       # do not check permission for intermediate formats

Modified: erp5/trunk/products/ERP5Catalog/CatalogTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/CatalogTool.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/CatalogTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Catalog/CatalogTool.py [utf8] Tue Sep 14 15:55:56 2010
@@ -546,7 +546,7 @@ class CatalogTool (UniqueObject, ZCatalo
       if allowedRolesAndUsers:
         allowedRolesAndUsers.sort()
         cache_key = tuple(allowedRolesAndUsers)
-        tv = getTransactionalVariable(self)
+        tv = getTransactionalVariable()
         try:
           security_uid_cache = tv['getSecurityUidListAndRoleColumnDict']
         except KeyError:

Modified: erp5/trunk/products/ERP5Form/PreferenceTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/PreferenceTool.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/PreferenceTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/PreferenceTool.py [utf8] Tue Sep 14 15:55:56 2010
@@ -226,7 +226,7 @@ class PreferenceTool(BaseTool):
     """ return the most appropriate preferences objects,
         sorted so that the first in the list should be applied first
     """
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     user = getToolByName(self, 'portal_membership').getAuthenticatedMember()
     tv_key = 'PreferenceTool._getSortedPreferenceList/%s/%s' % (user,
                                                                 sql_catalog_id)

Modified: erp5/trunk/products/ERP5Form/ProxyField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ProxyField.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ProxyField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/ProxyField.py [utf8] Tue Sep 14 15:55:56 2010
@@ -760,12 +760,12 @@ class ProxyField(ZMIField):
     return '%s%s' % ('ProxyField', self._p_oid or repr(self))
 
   def _setTemplateFieldCache(self, field):
-    getTransactionalVariable(self)[self._getCacheId()] = field
+    getTransactionalVariable()[self._getCacheId()] = field
 
   def _getTemplateFieldCache(self):
     parent = self.aq_parent
     if parent is not None:
-      cache = getTransactionalVariable(self)[self._getCacheId()]
+      cache = getTransactionalVariable()[self._getCacheId()]
       if cache is not None:
         return cache.__of__(parent)
     raise KeyError

Modified: erp5/trunk/products/ERP5Form/Tool/SelectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Tool/SelectionTool.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Tool/SelectionTool.py [utf8] Tue Sep 14 15:55:56 2010
@@ -1382,7 +1382,7 @@ class SelectionTool( BaseTool, SimpleIte
       return SelectionTool.inheritedAttribute('_aq_dynamic')(self, name)
 
     def _getUserId(self):
-      tv = getTransactionalVariable(self)
+      tv = getTransactionalVariable()
       user_id = tv.get('_user_id', None)
       if user_id is not None:
         return user_id
@@ -1400,7 +1400,7 @@ class SelectionTool( BaseTool, SimpleIte
       """ Temporary selections are used in push/pop nested scope,
       to prevent from editting for stored selection in the scope.
       Typically, it is used for ReportSection."""
-      tv = getTransactionalVariable(self)
+      tv = getTransactionalVariable()
       return tv.setdefault('_temporary_selection_dict', {})
 
     def pushSelection(self, selection_name):

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Tue Sep 14 15:55:56 2010
@@ -178,7 +178,7 @@ class WorkflowMethod(Method):
     # Build a list of transitions which may need to be invoked
     instance_path = instance.getPhysicalPath()
     portal_type = instance.portal_type
-    transactional_variable = getTransactionalVariable(instance)
+    transactional_variable = getTransactionalVariable()
     invoke_once_item_list = self._invoke_once.get(portal_type, {}).items()
     valid_invoke_once_item_list = []
     # Only keep those transitions which were never invoked
@@ -1086,7 +1086,7 @@ class Base( CopyContainer,
       going to edit the related object
     """
     # Push context to prevent loop
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     if isinstance(portal_type, list):
       portal_type = tuple(portal_type)
     acquisition_key = ('_getDefaultAcquiredProperty', self.getPath(), key,
@@ -1265,7 +1265,7 @@ class Base( CopyContainer,
 
     """
     # Push context to prevent loop
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     if isinstance(portal_type, list):
       portal_type = tuple(portal_type)
     acquisition_key = ('_getAcquiredPropertyList', self.getPath(), key, base_category,
@@ -3110,7 +3110,7 @@ class Base( CopyContainer,
     # use a transactional variable to cache results within the same
     # transaction
     portal_type = self.getPortalType()
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     type_base_cache = tv.setdefault('Base.type_based_cache', {})
 
     cache_key = (portal_type, method_id)
@@ -3811,7 +3811,7 @@ class Base( CopyContainer,
   def setDefaultReindexParameters(self, **kw):
     # This method sets the default keyword parameters to reindex. This is useful
     # when you need to specify special parameters implicitly (e.g. to reindexObject).
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     key = ('default_reindex_parameter', id(aq_base(self)))
     tv[key] = kw
 
@@ -3820,7 +3820,7 @@ class Base( CopyContainer,
   def getDefaultReindexParameterDict(self, inherit_placeless=True):
     # This method returns default reindex parameters to self.
     # The result can be either a dict object or None.
-    tv = getTransactionalVariable(self)
+    tv = getTransactionalVariable()
     if inherit_placeless:
       placeless = tv.get(('default_reindex_parameter', ))
       if placeless is not None:

Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Cache.py [utf8] Tue Sep 14 15:55:56 2010
@@ -299,7 +299,7 @@ def transactional_cached(key_method=lamb
   def decorator(function):
     key = repr(function)
     def wrapper(*args, **kw):
-      cache = getTransactionalVariable(None).setdefault(key, {})
+      cache = getTransactionalVariable().setdefault(key, {})
       subkey = key_method(*args, **kw)
       try:
         return cache[subkey]

Modified: erp5/trunk/products/ERP5Type/TransactionalVariable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/TransactionalVariable.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/TransactionalVariable.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/TransactionalVariable.py [utf8] Tue Sep 14 15:55:56 2010
@@ -55,6 +55,7 @@ Example::
     toto = tv['toto'] = getToto()
 """
 
+import warnings
 from UserDict import IterableUserDict
 from Shared.DC.ZRDB.TM import TM
 from threading import local
@@ -83,8 +84,13 @@ class TransactionalVariable(TM, Iterable
 
 transactional_variable_pool = local()
 
-def getTransactionalVariable(context):
+_MARKER = object()
+def getTransactionalVariable(context=_MARKER):
   """Return a transactional variable."""
+  if context is not _MARKER:
+    warnings.warn("Passing a parameter to getTransactionalVariable() is"
+                  " deprecated and will not be tolerated in the future",
+                  DeprecationWarning)
   try:
     return transactional_variable_pool.instance
   except AttributeError:

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Tue Sep 14 15:55:56 2010
@@ -1243,7 +1243,7 @@ def createExpressionContext(object, port
   """
     Return a context used for evaluating a TALES expression.
   """
-  tv = getTransactionalVariable(None)
+  tv = getTransactionalVariable()
   cache_key = ('createExpressionContext', id(object))
   try:
     return tv[cache_key]
@@ -1313,7 +1313,7 @@ def getExistingBaseCategoryList(portal, 
   cache = getReadOnlyTransactionCache(portal)
   if cache is None:
     from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
-    cache = getTransactionalVariable(portal)
+    cache = getTransactionalVariable()
   category_tool = portal.portal_categories
   new_base_cat_list = []
   for base_cat in base_cat_list:

Modified: erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testTransactionalVariable.py [utf8] Tue Sep 14 15:55:56 2010
@@ -55,7 +55,7 @@ class TestTransactionalVariable(ERP5Type
     def test_01_DictInterface(self):
       """Check if a transaction variable behaves in the same way as a dict.  """
    
-      tv = getTransactionalVariable(self.portal)
+      tv = getTransactionalVariable()
       self.failIfEqual(tv, None)
 
       # Test frequently used dict methods. This does not cover everything,
@@ -82,7 +82,7 @@ class TestTransactionalVariable(ERP5Type
       """Check if a transaction variable does not persist over multiple
       transactions.
       """
-      tv = getTransactionalVariable(self.portal)
+      tv = getTransactionalVariable()
       self.failIfEqual(tv, None)
 
       tv.clear()
@@ -104,7 +104,7 @@ class TestTransactionalVariable(ERP5Type
       """Check if a transaction variable does not disappear within the same
       transaction.
       """
-      tv = getTransactionalVariable(self.portal)
+      tv = getTransactionalVariable()
       self.failIfEqual(tv, None)
 
       tv.clear()

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=38366&r1=38365&r2=38366&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Tue Sep 14 15:55:56 2010
@@ -98,7 +98,7 @@ try:
   from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
 except ImportError:
   LOG('SQLCatalog', WARNING, 'Count not import getTransactionalVariable, expect slowness.')
-  def getTransactionalVariable(context):
+  def getTransactionalVariable():
     return {}
 
 class transactional_cache_decorator:
@@ -111,7 +111,7 @@ class transactional_cache_decorator:
 
   def __call__(self, method):
     def wrapper(wrapped_self):
-      transactional_cache = getTransactionalVariable(None)
+      transactional_cache = getTransactionalVariable()
       cache_id = self.cache_id
       try:
         result = transactional_cache[cache_id]




More information about the Erp5-report mailing list