python: domain: models: as_dict() should also exclude empty list fields
authorRob van der Linde <rob@catalyst.net.nz>
Sun, 24 Mar 2024 10:36:22 +0000 (23:36 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 28 Mar 2024 01:50:41 +0000 (01:50 +0000)
commited07dee8649eaf4266965e959e3d4c0b7e1c8a3e
tree86b1370c5cf03055125973ef25460968dc327e03
parentfc982e550f4c5824c189704efaf79038c0d78413
python: domain: models: as_dict() should also exclude empty list fields

Empty list fields happen if many=True is used on the field. This means that the field is automatically initialised as an empty list, so this can only ever be sa list or None.

The side-effect of this was that it appears in as_dict() when it shouldn't, because the field isn't populated. This fixes it.

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/domain/models/model.py