[docs] [issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism
Erno Tukia
report at bugs.python.org
Tue Jan 3 16:06:16 CET 2012
Erno Tukia <erno.tukia at iki.fi> added the comment:
In Python 2.6 PLAIN authentication works, in Python 3.1 not.
Lib/test/test_imaplib.py does not test IMAP4.authenticate() or IMAP4.login_cram_md5() functions, only IMAP4.login().
I would still like to go back to imaplib._Authenticator.encode() function. The function is below.
# inp = authobject(response)
def encode(self, inp):
oup = ''
while inp:
if len(inp) > 48:
t = inp[:48]
inp = inp[48:]
else:
t = inp
inp = ''
e = binascii.b2a_base64(t)
if e:
oup = oup + e[:-1]
return oup
binascii.b2a_base64() takes bytes, so inp must therefore be bytes, and returns bytes (Python 3). Then str + bytes (out + e[:-1]) fails.
The fix would then be changing
oup = oup + e[:-1]
to
oup = oup + e[:-1].decode()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13700>
_______________________________________
More information about the docs
mailing list