fixed memorize bug

This commit is contained in:
Vanshdeep Singh 2018-08-17 10:40:23 +00:00
parent 18964c0b2d
commit 3820d43eec

View File

@ -63,8 +63,12 @@ def memoize_class(func):
@functools.wraps(func)
def memoized_func(*args, **kwargs):
key = args[0].id
if key not in cache:
key = args[0]._id
if key is None:
result = func(*args, **kwargs)
cache[result['id']] = result
return result
elif key not in cache:
cache[key] = func(*args, **kwargs)
return cache[key]
@ -1146,8 +1150,7 @@ class Transaction(object):
return self._id
def to_hash(self):
return self.id
# return self.to_dict()['id']
return self.to_dict()['id']
@staticmethod
def _to_str(value):