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


Groups > comp.lang.python > #46235

RE: Ldap module and base64 oncoding

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jcasale@activenetwerx.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'encoding': 0.05; 'attribute': 0.07; 'binary': 0.07; 'encoded': 0.07; 'strings.': 0.09; 'subject:module': 0.09; 'attempted': 0.16; 'dict': 0.16; 'expects': 0.16; 'ldif': 0.16; 'michael,': 0.16; 'non-ascii': 0.16; 'overriding': 0.16; 'received:172.18.0': 0.16; 'stumbled': 0.16; 'yup,': 0.16; 'module': 0.19; 'passing': 0.19; 'properly': 0.19; 'work,': 0.20; 'seems': 0.21; 'to:name:python- list@python.org': 0.22; 'this?': 0.23; 'byte': 0.24; 'entries': 0.24; 'unicode': 0.24; 'handling': 0.26; 'pass': 0.26; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'idea': 0.28; 'character': 0.29; 'mode': 0.30; 'see,': 0.30; 'went': 0.31; 'code': 0.31; 'option': 0.32; 'open': 0.33; 'raw': 0.33; 'moment': 0.34; 'could': 0.34; 'knowledge': 0.35; 'convert': 0.35; 'but': 0.35; 'module.': 0.36; 'entry': 0.36; 'thanks': 0.36; 'application': 0.37; 'to:addr:python-list': 0.38; 'files': 0.38; 'expect': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:unknown': 0.61; 'today,': 0.61; 'simply': 0.61; "you're": 0.61; 'first': 0.61; 'making': 0.63; 'more': 0.64; 'therefore': 0.72; 'to:charset:iso-8859-1': 0.74
X-Cloudmark-SP-Filtered true
X-Cloudmark-SP-Result v=1.1 cv=x4wvebh7U2otgv2g1Q/ELETKOrtBkVhBqv1eL6GwWag= c=1 sm=1 a=P90J6pEA2ccA:10 a=xv9iwkAQU-cA:10 a=7PYXob_7ZXMA:10 a=BLceEmwcHowA:10 a=8nJEP1OIZ-IA:10 a=xqWC_Br6kY4A:10 a=oNw28mxuUhXRB3mVwYQ4Ag==:17 a=E47vONwXPlxBwylaY8wA:9 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
From "Joseph L. Casale" <jcasale@activenetwerx.com>
To Michael Ströder <michael@stroeder.com>, "python-list@python.org" <python-list@python.org>
Subject RE: Ldap module and base64 oncoding
Thread-Topic Ldap module and base64 oncoding
Thread-Index AQHOWq+62gcVydFyA0eXB9j8yy7c/ZkZeivw
Date Tue, 28 May 2013 00:12:58 +0000
References <knt87q$cm3$1@dont-email.me> <kntomp$jsn$1@dont-email.me> <knv3bs$b47$1@dont-email.me>
In-Reply-To <knv3bs$b47$1@dont-email.me>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [172.18.0.4]
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2269.1369699988.3114.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369699988 news.xs4all.nl 15917 [2001:888:2000:d::a6]:35528
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46235

Show key headers only | 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