On 20 Jul 2011, at 13:36, Graham Barr wrote: > > On Jul 20, 2011, at 07:32 , Francis Swasey wrote: > >> >> >> On Jul 20, 2011, at 8:26, Chris Ridd <chrisr...@mac.com> wrote: >> >>> >>>> >>>> >>>> >>> >>> Graham, should _escape be made public? It seems like it would be useful. Or >>> is manipulating the data structure returned from new the better approach? >> >> Perhaps a flag on the new call that indicates there are no escapes in the >> string so that the existing \, is not assumed to be a pre-existing escape >> and the \ gets escaped? > > That would not work consistently. consider (attr=()) > > Some guessing would have to go one to know that the first ) needs to be > escaped > > I think exporting _escape as escape_ldap_filter is the best approach and > users should use that as they build their filters
I'd call it escape_value - or at least something with "value" in the name - to make it clearer that you shouldn't pass a complete filter string into it. Chris