Delete the entity on variable.unset instead of setting it to null.

This commit is contained in:
Fabio Manganiello 2023-04-29 18:21:57 +02:00
parent b4048002b9
commit e96885a805
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -64,7 +64,11 @@ class VariablePlugin(Plugin, EntityManager):
:param name: Name of the variable to remove. :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) self._db_vars.pop(name, None)
return True return True