cpython: d30fd9834cec (original) (raw)

Mercurial > cpython

changeset 80574:d30fd9834cec

Issue #4473: Add a POP3.capa() method to query the capabilities advertised by the POP3 server. Patch by Lorenzo Catucci. [#4473]

Antoine Pitrou solipsis@pitrou.net
date Fri, 23 Nov 2012 20:07:39 +0100
parents 79e33578dc05
children 2329f9198d7f
files Doc/library/poplib.rst Lib/poplib.py Lib/test/test_poplib.py Misc/NEWS
diffstat 4 files changed, 57 insertions(+), 0 deletions(-)[+] [-] Doc/library/poplib.rst 8 Lib/poplib.py 30 Lib/test/test_poplib.py 16 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/poplib.rst +++ b/Doc/library/poplib.rst @@ -97,6 +97,14 @@ An :class:POP3 instance has the follow Returns the greeting string sent by the POP3 server. +.. method:: POP3.capa() +

+ .. method:: POP3.user(username) Send user command, response should indicate that a password is required.

--- a/Lib/poplib.py +++ b/Lib/poplib.py @@ -55,6 +55,7 @@ class POP3: APOP name digest apop(name, digest) TOP msg n top(msg, n) UIDL [msg] uidl(msg = None)

Raises one exception: 'error_proto'. @@ -322,6 +323,35 @@ class POP3: return self._shortcmd('UIDL %s' % which) return self._longcmd('UIDL') +

+

+

+ try: import ssl except ImportError:

--- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -33,6 +33,8 @@ line3\r\n[](#l3.3) class DummyPOP3Handler(asynchat.async_chat):

+ def init(self, conn): asynchat.async_chat.init(self, conn) self.set_terminator(b"\r\n") @@ -112,6 +114,16 @@ class DummyPOP3Handler(asynchat.async_ch self.push('+OK closing.') self.close_when_done()

+ class DummyPOP3Server(asyncore.dispatcher, threading.Thread): @@ -232,6 +244,10 @@ class TestPOP3Class(TestCase): self.client.uidl() self.client.uidl('foo')

+ def test_quit(self): resp = self.client.quit() self.assertTrue(resp)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,9 @@ Core and Builtins Library ------- +- Issue #4473: Add a POP3.capa() method to query the capabilities advertised