From 49ee75d986d0b324cc7e8ce2482444e21390efe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 11 Mar 2021 14:27:45 +0100 Subject: [PATCH] Fixed big mistake on storage --- server/src/uds/core/environment.py | 4 ++-- server/src/uds/core/util/storage.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/src/uds/core/environment.py b/server/src/uds/core/environment.py index 79c22b833..5db8857d3 100644 --- a/server/src/uds/core/environment.py +++ b/server/src/uds/core/environment.py @@ -146,9 +146,9 @@ class Environment: It will not make environment persistent """ env = Environment(TEMP_ENV) - env.storage.delete(TEMP_ENV) + env.storage.clean() env.cache.clean() - return Environment(TEMP_ENV) + return env @staticmethod def getGlobalEnv() -> 'Environment': diff --git a/server/src/uds/core/util/storage.py b/server/src/uds/core/util/storage.py index d0f0aca52..13431921e 100644 --- a/server/src/uds/core/util/storage.py +++ b/server/src/uds/core/util/storage.py @@ -265,6 +265,9 @@ class Storage: for v in self.filter(attr1, forUpdate): yield (v[0], pickle.loads(v[1]), v[2]) + def clean(self): + self.delete(self._owner) + @staticmethod def delete(owner: str) -> None: DBStorage.objects.filter(owner=owner).delete()