Commit 54b9ffe1 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

caching_class_method_decorator is now defined in ERP5Type.Cache.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29737 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 532f2d9b
...@@ -69,8 +69,9 @@ except ImportError: ...@@ -69,8 +69,9 @@ except ImportError:
psyco = None psyco = None
try: try:
from Products.ERP5Type.Cache import enableReadOnlyTransactionCache from Products.ERP5Type.Cache import enableReadOnlyTransactionCache, \
from Products.ERP5Type.Cache import disableReadOnlyTransactionCache, CachingMethod disableReadOnlyTransactionCache, CachingMethod, \
caching_class_method_decorator
except ImportError: except ImportError:
LOG('SQLCatalog', WARNING, 'Count not import CachingMethod, expect slowness.') LOG('SQLCatalog', WARNING, 'Count not import CachingMethod, expect slowness.')
def doNothing(context): def doNothing(context):
...@@ -83,18 +84,14 @@ except ImportError: ...@@ -83,18 +84,14 @@ except ImportError:
self.function = callable self.function = callable
def __call__(self, *opts, **kw): def __call__(self, *opts, **kw):
return self.function(*opts, **kw) return self.function(*opts, **kw)
class caching_class_method_decorator:
def __init__(self, *args, **kw):
pass
def __call__(self, method):
return method
enableReadOnlyTransactionCache = doNothing enableReadOnlyTransactionCache = doNothing
disableReadOnlyTransactionCache = doNothing disableReadOnlyTransactionCache = doNothing
class caching_class_method_decorator:
def __init__(self, *args, **kw):
self.args = args
self.kw = kw
def __call__(self, method):
caching_method = CachingMethod(method, *self.args, **self.kw)
return lambda *args, **kw: caching_method(*args, **kw)
try: try:
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
except ImportError: except ImportError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment