From 4954118b81e96ef677b1965d06427d626855e73f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Baumbach?= Date: Wed, 13 Mar 2019 17:40:37 +0100 Subject: [PATCH] samba-tool user edit: simplify code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Use "None"-changetype here, instead of "Add". This avoids the need to remove the changetype line afterwards. Signed-off-by: Björn Baumbach Reviewed-by: Andrew Bartlett --- python/samba/netcmd/user.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 28ff617f12b..112756ea4f5 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -2448,9 +2448,7 @@ LDAP server using the 'nano' editor. raise CommandError('Unable to find user "%s"' % (username)) for msg in res: - r_ldif = samdb.write_ldif(msg, 1) - # remove 'changetype' line - result_ldif = re.sub('changetype: add\n', '', r_ldif) + result_ldif = samdb.write_ldif(msg, ldb.CHANGETYPE_NONE) if editor is None: editor = os.environ.get('EDITOR') -- 2.47.3