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: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 5 additions and 1 deletions

View File

@ -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