#1485 DN, RDN object constructor pairwise behavior confusing
Closed: Fixed None Opened 12 years ago by jdennis.

Not all ideas are good :-) The pairwise (e.g. group by 2) behaviour for the RDN and DN object constructor's argument list has been shown to be confusing and/or difficult to use. It was originally written this way as syntactic shorthand for the programmer so they could avoid extra (excessive?) parenthesis in the argument lists (tuple construction). But in practice this has lead to surprising results for programmers who did not carefully read the documentation (but one shouldn't need to pour over the doc, it should be intuitive instead).

The common pitfall was two trailing string at the end of the arg list, one for a container DN and one for a base DN, e.g. DN('foo', 'bar', container_dn, base_dn) which did not produced the expected result of a dn with foo=bar appended with the container RDN's followed by the base RDN's. The constructor instead interpreted the args container_dn, base_dn as a string pair from which an RDN would be constructed. This is not what the programmer intended.

The fix is to remove the "group by 2" behaviour and instead require RDN's and AVA's to be explicitly enumerated via tuple or list pairing or via an RDN or AVA object.

This should be fixed before the dn.py gets too much use (it's still new) and before we fix the other dn issues by utilizing dn.py


Metadata Update from @jdennis:
- Issue assigned to jdennis
- Issue set to the milestone: FreeIPA 2.1 - 2011/07

7 years ago

Login to comment on this ticket.

Metadata