Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46235

RE: Ldap module and base64 oncoding

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Ldap module and base64 oncoding
Date 2013-05-28 00:12 +0000
References <knt87q$cm3$1@dont-email.me> <kntomp$jsn$1@dont-email.me> <knv3bs$b47$1@dont-email.me>
Newsgroups comp.lang.python
Message-ID <mailman.2269.1369699988.3114.python-list@python.org> (permalink)

Show all headers | View raw


> Note that all modules in python-ldap up to 2.4.10 including module 'ldif'
> expect raw byte strings to be passed as arguments. It seems to me you're
> passing a Unicode object in the entry dictionary which will fail in case an
> attribute value contains NON-ASCII chars.

Yup, I was.

> python-ldap expects raw strings since it's not schema-aware and therefore does
> not have any knowledge about the LDAP syntax used for a particular attribute
> type. So automagically convert Unicode strings will likely fail in many cases.
> => The calling application has to deal with it.

I see, that recco went a long a way in cleaning up my code actually and making the
handling of decoding and encoding more consistent.

> Don't muck with overriding  _unparseAttrTypeandValue(). Simply pass the
> properly encoded data into ldif module.

I had some time today, so I attempted to open the ldif files in binary mode to simply
work with the raw byte strings but the moment the first entry was parsed, parse()
stumbled on a character in the first entries dict and passed a dn of None for the last half?

If the option to avoid worrying about decoding and encoding could work, I would be
happy to process the whole lot in byte strings. Any idea what may cause this?

Thanks a lot Michael,
jlc

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Ldap module and base64 oncoding "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-05-24 21:00 +0000
  Re: Ldap module and base64 oncoding Michael Ströder <michael@stroeder.com> - 2013-05-26 17:07 +0200
    RE: Ldap module and base64 oncoding "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-05-26 16:19 +0000
      Re: Ldap module and base64 oncoding Michael Ströder <michael@stroeder.com> - 2013-05-26 21:48 +0200
        RE: Ldap module and base64 oncoding "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-05-27 05:15 +0000
          Re: Ldap module and base64 oncoding Michael Ströder <michael@stroeder.com> - 2013-05-27 09:56 +0200
            RE: Ldap module and base64 oncoding "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-05-28 00:12 +0000
              Re: Ldap module and base64 oncoding Michael Ströder <michael@stroeder.com> - 2013-05-28 09:45 +0200
        Re: Ldap module and base64 oncoding dieter <dieter@handshake.de> - 2013-05-27 08:04 +0200

csiph-web