-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12/20/2010 03:07 PM, Jan Zelený wrote: > Jakub Hrozek <jhro...@redhat.com> wrote: >> When deleting multiple objects, the code tries to enforce that the >> primary key is always iterable by doing: >> >> keys = keys[:-1] + (keys[-1], ) >> >> But this doesn't work, the line only concatenates two tuples effectively >> returning the original one. See the attached patch for a fix. > > nack: you have the condition in chunk #2 wrong - pkeyiter will be never None > > Jan >
Thanks, attached is a new patch. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk0PaBYACgkQHsardTLnvCVszQCeJLpRnhTlTE4sfXEsOGYHxTuM XNMAoOPT5ha6jlNRFlcg86GLAcElsRI8 =P15o -----END PGP SIGNATURE-----
From f187c602390f369c290bddb99ba74df491335701 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek <jhro...@redhat.com> Date: Tue, 14 Dec 2010 18:02:41 +0100 Subject: [PATCH] Make pkey always iterable when deleting --- ipalib/plugins/baseldap.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ipalib/plugins/baseldap.py b/ipalib/plugins/baseldap.py index 69682dc..ea974f9 100644 --- a/ipalib/plugins/baseldap.py +++ b/ipalib/plugins/baseldap.py @@ -889,12 +889,14 @@ class LDAPDelete(LDAPMultiQuery): return result if not self.obj.primary_key or not isinstance(keys[-1], (list, tuple)): - keys = keys[:-1] + (keys[-1], ) + pkeyiter = (keys[-1], ) + else: + pkeyiter = keys[-1] deleted = [] failed = [] result = True - for pkey in keys[-1]: + for pkey in pkeyiter: try: if not delete_entry(pkey): result = False @@ -905,7 +907,7 @@ class LDAPDelete(LDAPMultiQuery): else: deleted.append(pkey) - if self.obj.primary_key and keys[-1] is not None: + if self.obj.primary_key and pkeyiter[0] is not None: return dict(result=result, value=u','.join(deleted)) return dict(result=result, value=u'') -- 1.7.3.3
freeipa-jhrozek-028-02-pkey-iterable.patch.sig
Description: PGP signature
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel