Re-enabled debugging prints in poplib & documented the set_debuglevel()
method. This closes SF patch #486079.
This commit is contained in:
parent
3127c28b3f
commit
a16433b14e
|
@ -55,11 +55,19 @@ in lower-case; most return the response text sent by the server.
|
||||||
An \class{POP3} instance has the following methods:
|
An \class{POP3} instance has the following methods:
|
||||||
|
|
||||||
|
|
||||||
|
\begin{methoddesc}{set_debuglevel}{level}
|
||||||
|
Set the instance's debugging level. This controls the amount of
|
||||||
|
debugging output printed. The default, \code{0}, produces no
|
||||||
|
debugging output. A value of \code{1} produces a moderate amount of
|
||||||
|
debugging output, generally a single line per request. A value of
|
||||||
|
\code{2} or higher produces the maximum amount of debugging output,
|
||||||
|
logging each line sent and received on the control connection.
|
||||||
|
\end{methoddesc}
|
||||||
|
|
||||||
\begin{methoddesc}{getwelcome}{}
|
\begin{methoddesc}{getwelcome}{}
|
||||||
Returns the greeting string sent by the POP3 server.
|
Returns the greeting string sent by the POP3 server.
|
||||||
\end{methoddesc}
|
\end{methoddesc}
|
||||||
|
|
||||||
|
|
||||||
\begin{methoddesc}{user}{username}
|
\begin{methoddesc}{user}{username}
|
||||||
Send user command, response should indicate that a password is required.
|
Send user command, response should indicate that a password is required.
|
||||||
\end{methoddesc}
|
\end{methoddesc}
|
||||||
|
|
|
@ -96,14 +96,14 @@ class POP3:
|
||||||
|
|
||||||
|
|
||||||
def _putline(self, line):
|
def _putline(self, line):
|
||||||
#if self._debugging > 1: print '*put*', `line`
|
if self._debugging > 1: print '*put*', `line`
|
||||||
self.sock.send('%s%s' % (line, CRLF))
|
self.sock.send('%s%s' % (line, CRLF))
|
||||||
|
|
||||||
|
|
||||||
# Internal: send one command to the server (through _putline())
|
# Internal: send one command to the server (through _putline())
|
||||||
|
|
||||||
def _putcmd(self, line):
|
def _putcmd(self, line):
|
||||||
#if self._debugging: print '*cmd*', `line`
|
if self._debugging: print '*cmd*', `line`
|
||||||
self._putline(line)
|
self._putline(line)
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class POP3:
|
||||||
|
|
||||||
def _getline(self):
|
def _getline(self):
|
||||||
line = self.file.readline()
|
line = self.file.readline()
|
||||||
#if self._debugging > 1: print '*get*', `line`
|
if self._debugging > 1: print '*get*', `line`
|
||||||
if not line: raise error_proto('-ERR EOF')
|
if not line: raise error_proto('-ERR EOF')
|
||||||
octets = len(line)
|
octets = len(line)
|
||||||
# server can send any combination of CR & LF
|
# server can send any combination of CR & LF
|
||||||
|
@ -131,7 +131,7 @@ class POP3:
|
||||||
|
|
||||||
def _getresp(self):
|
def _getresp(self):
|
||||||
resp, o = self._getline()
|
resp, o = self._getline()
|
||||||
#if self._debugging > 1: print '*resp*', `resp`
|
if self._debugging > 1: print '*resp*', `resp`
|
||||||
c = resp[:1]
|
c = resp[:1]
|
||||||
if c != '+':
|
if c != '+':
|
||||||
raise error_proto(resp)
|
raise error_proto(resp)
|
||||||
|
@ -205,7 +205,7 @@ class POP3:
|
||||||
"""
|
"""
|
||||||
retval = self._shortcmd('STAT')
|
retval = self._shortcmd('STAT')
|
||||||
rets = retval.split()
|
rets = retval.split()
|
||||||
#if self._debugging: print '*stat*', `rets`
|
if self._debugging: print '*stat*', `rets`
|
||||||
numMessages = int(rets[1])
|
numMessages = int(rets[1])
|
||||||
sizeMessages = int(rets[2])
|
sizeMessages = int(rets[2])
|
||||||
return (numMessages, sizeMessages)
|
return (numMessages, sizeMessages)
|
||||||
|
|
Loading…
Reference in New Issue