Structure handlers to allow .get() to return lists

See #1154. In the end I didn't modify the Attributehandler and
TagHandler like this, instead I added the `return_list` argument
for cases when one wants a guaranteed return.
This commit is contained in:
Griatch 2017-08-27 14:56:05 +02:00
parent 05a3d0435d
commit 92df3ce5ae
13 changed files with 86 additions and 1608 deletions

View file

@ -93,6 +93,7 @@ class MonitorHandler(object):
def at_update(self, obj, fieldname):
"""
Called by the field as it saves.
"""
to_delete = []
if obj in self.monitors and fieldname in self.monitors[obj]:
@ -175,6 +176,9 @@ class MonitorHandler(object):
"""
List all monitors.
Returns:
monitors (list): The handled monitors.
"""
output = []
for obj in self.monitors: