mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-28 12:32:49 +02:00
The memoization doesn't work when objects don't have a primary key.
This commit is contained in:
@ -49,7 +49,10 @@ def memoize(f):
|
||||
# lru_cache makes the job of memoization
|
||||
# We store only the 512 latest data per session. It has to be enough.
|
||||
sess_funs[sess_key] = lru_cache(512)(f)
|
||||
return sess_funs[sess_key](*args, **kwargs)
|
||||
try:
|
||||
return sess_funs[sess_key](*args, **kwargs)
|
||||
except TypeError: # For add permissions, objects are not hashable (not yet created). Don't memoize this case.
|
||||
return f(*args, **kwargs)
|
||||
|
||||
func.func_name = f.__name__
|
||||
|
||||
|
Reference in New Issue
Block a user