cpython: 6ea762200e27 (original) (raw)

Mercurial > cpython

changeset 96101:6ea762200e27

#21804: Add RFC 6856 (UTF8) support to poplib. Patch by Milan Oberkirch. [#21804]

R David Murray rdmurray@bitdance.com
date Sat, 16 May 2015 15:05:53 -0400
parents c77a42c234d6
children 09bd552999bf
files Doc/library/poplib.rst Doc/whatsnew/3.5.rst Lib/poplib.py Lib/test/test_poplib.py Misc/NEWS
diffstat 5 files changed, 41 insertions(+), 0 deletions(-)[+] [-] Doc/library/poplib.rst 9 Doc/whatsnew/3.5.rst 7 Lib/poplib.py 7 Lib/test/test_poplib.py 16 Misc/NEWS 2

line wrap: on

line diff

--- a/Doc/library/poplib.rst +++ b/Doc/library/poplib.rst @@ -194,6 +194,15 @@ An :class:POP3 instance has the follow the unique id for that message in the form 'response mesgnum uid, otherwise result is list (response, ['mesgnum uid', ...], octets). + +.. method:: POP3.utf8() +

+ .. method:: POP3.stls(context=None) Start a TLS session on the active connection as specified in :rfc:2595.

--- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -452,6 +452,13 @@ pickle classes) now are supported with pickle protocols < 4. (Contributed by Serhiy Storchaka in :issue:23611.) +poplib +------ + +* A new command :meth:~poplib.POP3.utf8 enables :rfc:6856

--- a/Lib/poplib.py +++ b/Lib/poplib.py @@ -71,6 +71,7 @@ class POP3: UIDL [msg] uidl(msg = None) CAPA capa() STLS stls()

Raises one exception: 'error_proto'. @@ -348,6 +349,12 @@ class POP3: return self._longcmd('UIDL')

+ + def capa(self): """Return server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost')

--- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -44,6 +44,7 @@ line3\r\n[](#l4.3) class DummyPOP3Handler(asynchat.async_chat): CAPAS = {'UIDL': [], 'IMPLEMENTATION': ['python-testlib-pop-server']}

def init(self, conn): asynchat.async_chat.init(self, conn) @@ -142,6 +143,11 @@ class DummyPOP3Handler(asynchat.async_ch self.push(' '.join(_ln)) self.push('.')

+ if SUPPORTS_SSL: def cmd_stls(self, arg): @@ -309,6 +315,16 @@ class TestPOP3Class(TestCase): self.client.uidl() self.client.uidl('foo')

+

+ def test_capa(self): capa = self.client.capa() self.assertTrue('IMPLEMENTATION' in capa.keys())

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,8 @@ Core and Builtins Library ------- +- Issue #21804: poplib now supports RFC 6856 (UTF8). +