samdb: add prepare_attr_replace() method
authorJule Anger <ja@sernet.de>
Mon, 24 Aug 2020 14:34:35 +0000 (16:34 +0200)
committerDouglas Bagnall <dbagnall@samba.org>
Thu, 1 Oct 2020 01:18:39 +0000 (01:18 +0000)
commita22a80ed6e8494b3edb717c3b288c7adde5092ee
treebba3e1da37b0205b5000d7f9d152e5d6a094d3ee
parent88663eb949a4cd097d3cdadd960251542ccb6064
samdb: add prepare_attr_replace() method

Add a method to prepare a given Message to replace the given attribute.
If the given new value is None or the old value and the new value are
the same, do nothing.
If the new value is empty, prepare to replace the given attribute with
[].
Else prepare to replace the given attribute with the new value.

Use this for samdb.modify(msg).

Signed-off-by: Jule Anger <ja@sernet.de>
Reviewed-by: Björn Baumbach <bb@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/samdb.py