summaryrefslogtreecommitdiffstats
path: root/Lib/imaplib.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-11-16 17:55:26 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-11-16 17:55:26 (GMT)
commitdbe7519da9d0a99d68aaa773cde2793900dad44f (patch)
tree71e84e5f556b6021132452a1c3a7f7ac440fe6e1 /Lib/imaplib.py
parent36c0dbc9be1f21feec2218e3357fbf3a4dded8c1 (diff)
downloadcpython-dbe7519da9d0a99d68aaa773cde2793900dad44f.zip
cpython-dbe7519da9d0a99d68aaa773cde2793900dad44f.tar.gz
cpython-dbe7519da9d0a99d68aaa773cde2793900dad44f.tar.bz2
Issue #10429: IMAP.starttls() stored the capabilities as bytes objects,
rather than strings.
Diffstat (limited to 'Lib/imaplib.py')
-rw-r--r--Lib/imaplib.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 421cb97..9c38e1c 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -196,13 +196,7 @@ class IMAP4:
else:
raise self.error(self.welcome)
- typ, dat = self.capability()
- if dat == [None]:
- raise self.error('no CAPABILITY response from server')
- dat = str(dat[-1], "ASCII")
- dat = dat.upper()
- self.capabilities = tuple(dat.split())
-
+ self._get_capabilities()
if __debug__:
if self.debug >= 3:
self._mesg('CAPABILITIES: %r' % (self.capabilities,))
@@ -737,10 +731,7 @@ class IMAP4:
self.sock = ssl_context.wrap_socket(self.sock)
self.file = self.sock.makefile('rb')
self._tls_established = True
- typ, dat = self.capability()
- if dat == [None]:
- raise self.error('no CAPABILITY response from server')
- self.capabilities = tuple(dat[-1].upper().split())
+ self._get_capabilities()
else:
raise self.error("Couldn't establish TLS session")
return self._untagged_response(typ, dat, name)
@@ -956,6 +947,15 @@ class IMAP4:
return typ, data
+ def _get_capabilities(self):
+ typ, dat = self.capability()
+ if dat == [None]:
+ raise self.error('no CAPABILITY response from server')
+ dat = str(dat[-1], "ASCII")
+ dat = dat.upper()
+ self.capabilities = tuple(dat.split())
+
+
def _get_response(self):
# Read response and store.