forked from platypush/platypush
Delete the entity on variable.unset
instead of setting it to null.
This commit is contained in:
parent
b4048002b9
commit
e96885a805
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue