[Erp5-report] r13762 - /erp5/trunk/products/ERP5Type/Cache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 28 16:50:43 CEST 2007


Author: yo
Date: Wed Mar 28 16:50:42 2007
New Revision: 13762

URL: http://svn.erp5.org?rev=13762&view=rev
Log:
Re-implement read-only transaction cache in the term of a transactional variable.

Modified:
    erp5/trunk/products/ERP5Type/Cache.py

Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=13762&r1=13761&r2=13762&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Wed Mar 28 16:50:42 2007
@@ -31,6 +31,7 @@
 from AccessControl.SecurityInfo import allow_class
 from CachePlugins.BaseCache import CachedMethodError
 from zLOG import LOG, WARNING
+from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
 
 DEFAULT_CACHE_SCOPE = 'GLOBAL'
 DEFAULT_CACHE_FACTORY = 'erp5_ui_short'
@@ -224,20 +225,26 @@
 def getReadOnlyTransactionCache(context):
   """Get the transaction cache.
   """
+  tv = getTransactionalVariable()
   try:
-    return context.REQUEST['_erp5_read_only_transaction_cache']
+    return tv['read_only_transaction_cache']
   except KeyError:
     return None
 
 def enableReadOnlyTransactionCache(context):
   """Enable the transaction cache.
   """
-  context.REQUEST.set('_erp5_read_only_transaction_cache', {})
+  tv = getTransactionalVariable()
+  tv['read_only_transaction_cache'] = {}
 
 def disableReadOnlyTransactionCache(context):
   """Disable the transaction cache.
   """
-  context.REQUEST.set('_erp5_read_only_transaction_cache', None)
+  tv = getTransactionalVariable()
+  try:
+    del tv['read_only_transaction_cache']
+  except KeyError:
+    pass
 
 ########################################################
 ## Old global cache functions                         ##




More information about the Erp5-report mailing list