mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
fixed memorize bug
This commit is contained in:
parent
18964c0b2d
commit
3820d43eec
@ -63,8 +63,12 @@ def memoize_class(func):
|
|||||||
|
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def memoized_func(*args, **kwargs):
|
def memoized_func(*args, **kwargs):
|
||||||
key = args[0].id
|
key = args[0]._id
|
||||||
if key not in cache:
|
if key is None:
|
||||||
|
result = func(*args, **kwargs)
|
||||||
|
cache[result['id']] = result
|
||||||
|
return result
|
||||||
|
elif key not in cache:
|
||||||
cache[key] = func(*args, **kwargs)
|
cache[key] = func(*args, **kwargs)
|
||||||
|
|
||||||
return cache[key]
|
return cache[key]
|
||||||
@ -1146,8 +1150,7 @@ class Transaction(object):
|
|||||||
return self._id
|
return self._id
|
||||||
|
|
||||||
def to_hash(self):
|
def to_hash(self):
|
||||||
return self.id
|
return self.to_dict()['id']
|
||||||
# return self.to_dict()['id']
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _to_str(value):
|
def _to_str(value):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user