Skip to content

Commit

Permalink
Re-enabled debugging prints in poplib & documented the set_debuglevel()
Browse files Browse the repository at this point in the history
method.
This closes SF patch #486079.
  • Loading branch information
freddrake committed Dec 5, 2001
1 parent 3127c28 commit a16433b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion Doc/lib/libpoplib.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ \subsection{POP3 Objects \label{pop3-objects}}
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}{}
Returns the greeting string sent by the POP3 server.
\end{methoddesc}


\begin{methoddesc}{user}{username}
Send user command, response should indicate that a password is required.
\end{methoddesc}
Expand Down
10 changes: 5 additions & 5 deletions Lib/poplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ def __init__(self, host, port = POP3_PORT):


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))


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

def _putcmd(self, line):
#if self._debugging: print '*cmd*', `line`
if self._debugging: print '*cmd*', `line`
self._putline(line)


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

def _getline(self):
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')
octets = len(line)
# server can send any combination of CR & LF
Expand All @@ -131,7 +131,7 @@ def _getline(self):

def _getresp(self):
resp, o = self._getline()
#if self._debugging > 1: print '*resp*', `resp`
if self._debugging > 1: print '*resp*', `resp`
c = resp[:1]
if c != '+':
raise error_proto(resp)
Expand Down Expand Up @@ -205,7 +205,7 @@ def stat(self):
"""
retval = self._shortcmd('STAT')
rets = retval.split()
#if self._debugging: print '*stat*', `rets`
if self._debugging: print '*stat*', `rets`
numMessages = int(rets[1])
sizeMessages = int(rets[2])
return (numMessages, sizeMessages)
Expand Down

0 comments on commit a16433b

Please sign in to comment.