deepcopy cahced object before returing it

This commit is contained in:
Oran Nadler 2018-05-15 13:49:23 +03:00
parent d0ce419ae0
commit 3cff5edffe
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import hashlib
import binascii
import copy
from pymongo import MongoClient
class mongo(object):
@ -106,7 +107,7 @@ def cache(foo):
if hashed not in foo._mycache_.keys():
foo._mycache_[hashed] = foo(*args, **kwargs)
return foo._mycache_[hashed]
return copy.deepcopy(foo._mycache_[hashed])
return wrapper