Fixed big mistake on storage

This commit is contained in:
Adolfo Gómez García 2021-03-11 14:27:45 +01:00
parent 2acc72a1f7
commit 49ee75d986
2 changed files with 5 additions and 2 deletions

View File

@ -146,9 +146,9 @@ class Environment:
It will not make environment persistent It will not make environment persistent
""" """
env = Environment(TEMP_ENV) env = Environment(TEMP_ENV)
env.storage.delete(TEMP_ENV) env.storage.clean()
env.cache.clean() env.cache.clean()
return Environment(TEMP_ENV) return env
@staticmethod @staticmethod
def getGlobalEnv() -> 'Environment': def getGlobalEnv() -> 'Environment':

View File

@ -265,6 +265,9 @@ class Storage:
for v in self.filter(attr1, forUpdate): for v in self.filter(attr1, forUpdate):
yield (v[0], pickle.loads(v[1]), v[2]) yield (v[0], pickle.loads(v[1]), v[2])
def clean(self):
self.delete(self._owner)
@staticmethod @staticmethod
def delete(owner: str) -> None: def delete(owner: str) -> None:
DBStorage.objects.filter(owner=owner).delete() DBStorage.objects.filter(owner=owner).delete()