jcholast commented on a pull request

This is not very comprehensible. I would rather replace the:
```python
    dn = self.obj.get_either_dn(*keys, **options)
```
at the beginning of `user_add.pre_callback` with:
```python
    delete_dn = self.obj.get_delete_dn(*keys, **options)
    try:
        ldap.get_entry(delete_dn, [''])
    except errors.NotFound:
        pass
    else:
        self.obj.handle_duplicate_entry(*keys)
```
Note that this assumes that the routine to get `delete_dn` was split off from 
`user.get_either_dn()` into `user.get_delete_dn()` to avoid copy-pasta.

See the full comment at 
https://github.com/freeipa/freeipa/pull/3#issuecomment-241318444
-- 
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

Reply via email to