This would help on a few cases, such as to create an entry only if it doesn't exist already.
Metadata Update from @ilias95: - Issue assigned to ilias95
I didn't know where to place my test case, so I created a new file. Is there something already for testing DSLdapObject functionality?
Metadata Update from @ilias95: - Custom field Review Status adjusted to review
I think that what you have there for tests is okay - normally the object is test by proxy through other classes,
So I'm happy with that.
I think the only concern I have is the check using getENtry, if we do .exists, then access, we do the same search twice. I think getEntry actually gets * by default for attrs.
So perhaps we should do a search like:
self._instance.search_s(self._dn, ldap.SCOPE_BASE, attrsonly=1)
Only question I have is if we should add the filters in, but I suspect we shouldn't - my thinking is if you do this on say a group, but it's actually a user at that dn, this would say exists is false, but somtheng DOES exist, just with the wrong ocs. So I think we should get something at the DN and then go from there.
attrsonly=1 means don't transfer any attributes in the result, so this should be a really fast check for existance of the object.
You're right about it being inefficient. I changed it as you suggested.
I agree. I think that if something does indeed exist with that DN the method should return True.
Ack, great stuff again mate,
commit b66a2d03997c82f558216e151b6622234b431b8a To ssh://git@pagure.io/lib389.git c7f4d7e..b66a2d0 master -> master
Metadata Update from @firstyear: - Custom field Review Status adjusted to ack (was: review)
Metadata Update from @ilias95: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)