Re: [Freeipa-devel] [PATCH 0001] Fixed incorrect ldap_uri population
Hi, Dne 24.4.2015 v 16:27 Oleg Fayans napsal(a): This one is even more correct. On 04/24/2015 04:05 PM, Oleg Fayans wrote: Corresponding ticket is https://fedorahosted.org/freeipa/ticket/5002 thanks for the patch, but the bug is purely hypothetical, as the __ldap_uri attribute is always set. Anyway, you shouldn't use 'name' in dir(obj) to check if attribute is set, there is hasattr(obj, 'name') for that. Also, __ldap_uri starts with two underscores, so the name is mangled to _ldap2__ldap_uri, which means the check in your patch will always fail and ldap_uri will always return self.api.env.ldap_uri, which is in fact more wrong than the current behavior. Honza -- Jan Cholasta -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0001] Fixed incorrect ldap_uri population
This one is even more correct. On 04/24/2015 04:05 PM, Oleg Fayans wrote: Corresponding ticket is https://fedorahosted.org/freeipa/ticket/5002 -- Oleg Fayans Quality Engineer FreeIPA team RedHat. From c0b7322c804e9cc327b2caa248e2b1d6614e4e06 Mon Sep 17 00:00:00 2001 From: ofayans ofay...@redhat.com Date: Fri, 24 Apr 2015 15:40:14 +0200 Subject: [PATCH 1/2] Fixed incorrect ldap_uri population --- ipaserver/plugins/ldap2.py | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py index fd4ed29..59ebaf7 100644 --- a/ipaserver/plugins/ldap2.py +++ b/ipaserver/plugins/ldap2.py @@ -79,9 +79,11 @@ class ldap2(LDAPClient, CrudBackend): @property def ldap_uri(self): -try: - return self.__ldap_uri or self.api.env.ldap_uri +if '__ldap_uri' in dir(self) and self.__ldap_uri: +return self.__ldap_uri -except AttributeError: +elif self.api.env.ldap_uri: +return self.api.env.ldap_uri +else: return 'ldap://example.com' @ldap_uri.setter -- 2.1.0 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code