Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a16433b

Browse files
committed
Re-enabled debugging prints in poplib & documented the set_debuglevel()
method. This closes SF patch #486079.
1 parent 3127c28 commit a16433b

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

Doc/lib/libpoplib.tex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ \subsection{POP3 Objects \label{pop3-objects}}
5555
An \class{POP3} instance has the following methods:
5656

5757

58+
\begin{methoddesc}{set_debuglevel}{level}
59+
Set the instance's debugging level. This controls the amount of
60+
debugging output printed. The default, \code{0}, produces no
61+
debugging output. A value of \code{1} produces a moderate amount of
62+
debugging output, generally a single line per request. A value of
63+
\code{2} or higher produces the maximum amount of debugging output,
64+
logging each line sent and received on the control connection.
65+
\end{methoddesc}
66+
5867
\begin{methoddesc}{getwelcome}{}
5968
Returns the greeting string sent by the POP3 server.
6069
\end{methoddesc}
6170

62-
6371
\begin{methoddesc}{user}{username}
6472
Send user command, response should indicate that a password is required.
6573
\end{methoddesc}

Lib/poplib.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ def __init__(self, host, port = POP3_PORT):
9696

9797

9898
def _putline(self, line):
99-
#if self._debugging > 1: print '*put*', `line`
99+
if self._debugging > 1: print '*put*', `line`
100100
self.sock.send('%s%s' % (line, CRLF))
101101

102102

103103
# Internal: send one command to the server (through _putline())
104104

105105
def _putcmd(self, line):
106-
#if self._debugging: print '*cmd*', `line`
106+
if self._debugging: print '*cmd*', `line`
107107
self._putline(line)
108108

109109

@@ -113,7 +113,7 @@ def _putcmd(self, line):
113113

114114
def _getline(self):
115115
line = self.file.readline()
116-
#if self._debugging > 1: print '*get*', `line`
116+
if self._debugging > 1: print '*get*', `line`
117117
if not line: raise error_proto('-ERR EOF')
118118
octets = len(line)
119119
# server can send any combination of CR & LF
@@ -131,7 +131,7 @@ def _getline(self):
131131

132132
def _getresp(self):
133133
resp, o = self._getline()
134-
#if self._debugging > 1: print '*resp*', `resp`
134+
if self._debugging > 1: print '*resp*', `resp`
135135
c = resp[:1]
136136
if c != '+':
137137
raise error_proto(resp)
@@ -205,7 +205,7 @@ def stat(self):
205205
"""
206206
retval = self._shortcmd('STAT')
207207
rets = retval.split()
208-
#if self._debugging: print '*stat*', `rets`
208+
if self._debugging: print '*stat*', `rets`
209209
numMessages = int(rets[1])
210210
sizeMessages = int(rets[2])
211211
return (numMessages, sizeMessages)

0 commit comments

Comments
 (0)