From e96885a805595ba77101ad85b9c06c22dd3f0b12 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 29 Apr 2023 18:21:57 +0200 Subject: [PATCH] Delete the entity on `variable.unset` instead of setting it to null. --- platypush/plugins/variable/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/variable/__init__.py b/platypush/plugins/variable/__init__.py index 204fc6903..f40cc09f7 100644 --- a/platypush/plugins/variable/__init__.py +++ b/platypush/plugins/variable/__init__.py @@ -64,7 +64,11 @@ class VariablePlugin(Plugin, EntityManager): :param name: Name of the variable to remove. """ - self.publish_entities({name: None}) + with self._db.get_session() as session: + entity = session.query(Variable).filter(Variable.name == name).first() + if entity is not None: + self._entities.delete(entity.id) + self._db_vars.pop(name, None) return True