diff --git a/slic/core/device/filtered.py b/slic/core/device/filtered.py index 2fae0912..4e8d30e4 100644 --- a/slic/core/device/filtered.py +++ b/slic/core/device/filtered.py @@ -3,17 +3,20 @@ from .simpledevice import SimpleDevice def by_type(dev, typ): - #TODO: adjust ID, name, description - res = SimpleDevice(dev.ID, name=dev.name, description=dev.description) + res = {} for k, v in dev.__dict__.items(): if isinstance(v, typ): - new = v + res[k] = v elif isinstance(v, Device): new = by_type(v, typ) - else: - continue # ignore not matching - res.__dict__[k] = new - return res + if new: + res[k] = new + + if res: + #TODO: adjust ID, name, description + return SimpleDevice(dev.ID, name=dev.name, description=dev.description, **res) + else: + return None