Commit 6e94f9ba authored by Vincent Pelletier's avatar Vincent Pelletier

Factorise code a tiny bit.

This prepares for more invasive changes about cache_id computation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37184 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83dd1ab7
......@@ -112,11 +112,12 @@ class transactional_cache_decorator:
def __call__(self, method):
def wrapper(wrapped_self):
transactional_cache = getTransactionalVariable(None)
cache_id = self.cache_id
try:
return transactional_cache[self.cache_id]
result = transactional_cache[cache_id]
except KeyError:
result = transactional_cache[self.cache_id] = method(wrapped_self)
return result
result = transactional_cache[cache_id] = method(wrapped_self)
return result
return wrapper
try:
......
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