michael at stroeder.com
Thu May 24 14:56:01 CEST 2007
Alain Spineux wrote:
> On 5/24/07, Michael Ströder <michael at stroeder.com> wrote:
>> "One cannot always assume UTF-8 encoded Unicode strings in
>> attribute values. Think of attributes jpegPhoto,
> When writing my ldap.search() request I know jpegPhoto is raw data and
> not a string !
> This is why I will use 'jpegPhoto' and not u'jpegPhoto' in the
> attribute list.
And how about specials like '*' and '+' in attrlist?
>> > what about the use of this kind of request ?
>> > ldap_con.search_s(base_dn, ldap.SCOPE_BASE, filter, ['cn', 'mail',
>> > u'givenName', u'sn' ])
>> > that way, python-lib know that attribute givenName and sn should be
>> > decoded into unicode string.
>> This will be cumbersome. You will have to pass these attributes into
>> method result() which in general has no knowledge about a particular
>> request it's receiving results for. And I'll keep it like this because I
> Ops, I forgot the asynchronous side of ldap, but the msgid make the link
> between both
> the request and the result and a dictionary store in the ldapobject
> could store the
> unicode transcoding info used in the request. And then ldap.result(),
> could use these
> info to decode the value when user call it.
Yes, you could do this. But IMO it's cumbersome.
> I'start writin a wrapper for search() and modify() now.
> I send you my results as soon a possible.
I'm not too keen to incorporate Unicode patches in python-ldap's
More information about the python-ldap