Commit c3033d15 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

simplify the definition of caching_class_method_decorator, thanks to Julien.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29739 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9f126c0f
......@@ -278,13 +278,6 @@ def generateCacheIdWithoutFirstArg(method_id, *args, **kwd):
# is 'self' that can be ignored to create a cache id.
return str((method_id, args[1:], kwd))
class caching_class_method_decorator:
def __init__(self, *args, **kw):
self.args = args
kw.setdefault(
'cache_id_func', generateCacheIdWithoutFirstArg)
self.kw = kw
def __call__(self, method):
caching_method = CachingMethod(method, *self.args, **self.kw)
return lambda *args, **kw: caching_method(*args, **kw)
def caching_class_method_decorator(*args, **kw):
kw.setdefault('cache_id_func', generateCacheIdWithoutFirstArg)
return lambda method: CachingMethod(method, *args, **kw)
......@@ -84,11 +84,8 @@ except ImportError:
self.function = callable
def __call__(self, *opts, **kw):
return self.function(*opts, **kw)
class caching_class_method_decorator:
def __init__(self, *args, **kw):
pass
def __call__(self, method):
return method
def caching_class_method_decorator(*args, **kw):
return lambda method: method
enableReadOnlyTransactionCache = doNothing
disableReadOnlyTransactionCache = doNothing
......
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