Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0d9b61be
Commit
0d9b61be
authored
Oct 18, 2001
by
Fredrik Lundh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed misleading argument name
parent
3fe4d9c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
Doc/lib/libnntplib.tex
Doc/lib/libnntplib.tex
+5
-5
Lib/nntplib.py
Lib/nntplib.py
+13
-13
No files found.
Doc/lib/libnntplib.tex
View file @
0d9b61be
...
@@ -197,14 +197,14 @@ and \var{list} is a list of the article's headers (an uninterpreted
...
@@ -197,14 +197,14 @@ and \var{list} is a list of the article's headers (an uninterpreted
list of lines, without trailing newlines).
list of lines, without trailing newlines).
\end{methoddesc}
\end{methoddesc}
\begin{methoddesc}
{
body
}{
id,
\optional
{
file
Handle
}}
\begin{methoddesc}
{
body
}{
id,
\optional
{
file
}}
Send a
\samp
{
BODY
}
command, where
\var
{
id
}
has the same meaning as for
Send a
\samp
{
BODY
}
command, where
\var
{
id
}
has the same meaning as for
\method
{
stat()
}
. If the
\var
{
file
Handle
}
parameter is supplied, then
\method
{
stat()
}
. If the
\var
{
file
}
parameter is supplied, then
the body is stored in a file. If
\var
{
file
Handle
}
is a string, then
the body is stored in a file. If
\var
{
file
}
is a string, then
the method will open a file object with that name, write to it then close it.
the method will open a file object with that name, write to it then close it.
If
\var
{
file
Handle
}
is a file object, then it will start calling
If
\var
{
file
}
is a file object, then it will start calling
\method
{
write()
}
on it to store the lines of the body.
\method
{
write()
}
on it to store the lines of the body.
Return as for
\method
{
head()
}
. If
\var
{
file
Handle
}
is supplied. Then
Return as for
\method
{
head()
}
. If
\var
{
file
}
is supplied. Then
the returned
\var
{
list
}
is an empty list.
the returned
\var
{
list
}
is an empty list.
\end{methoddesc}
\end{methoddesc}
...
...
Lib/nntplib.py
View file @
0d9b61be
...
@@ -211,15 +211,15 @@ class NNTP:
...
@@ -211,15 +211,15 @@ class NNTP:
raise
NNTPProtocolError
(
resp
)
raise
NNTPProtocolError
(
resp
)
return
resp
return
resp
def
getlongresp
(
self
,
fileHand
le
=
None
):
def
getlongresp
(
self
,
fi
le
=
None
):
"""Internal: get a response plus following text from the server.
"""Internal: get a response plus following text from the server.
Raise various errors if the response indicates an error."""
Raise various errors if the response indicates an error."""
openedFile
=
None
openedFile
=
None
try
:
try
:
# If a string was passed then open a file with that name
# If a string was passed then open a file with that name
if
isinstance
(
file
Handle
,
types
.
StringType
):
if
isinstance
(
file
,
types
.
StringType
):
openedFile
=
file
Handle
=
open
(
fileHand
le
,
"w"
)
openedFile
=
file
=
open
(
fi
le
,
"w"
)
resp
=
self
.
getresp
()
resp
=
self
.
getresp
()
if
resp
[:
3
]
not
in
LONGRESP
:
if
resp
[:
3
]
not
in
LONGRESP
:
...
@@ -231,8 +231,8 @@ class NNTP:
...
@@ -231,8 +231,8 @@ class NNTP:
break
break
if
line
[:
2
]
==
'..'
:
if
line
[:
2
]
==
'..'
:
line
=
line
[
1
:]
line
=
line
[
1
:]
if
file
Handle
:
if
file
:
file
Handle
.
write
(
line
+
"
\
n
"
)
file
.
write
(
line
+
"
\
n
"
)
else
:
else
:
list
.
append
(
line
)
list
.
append
(
line
)
finally
:
finally
:
...
@@ -247,10 +247,10 @@ class NNTP:
...
@@ -247,10 +247,10 @@ class NNTP:
self
.
putcmd
(
line
)
self
.
putcmd
(
line
)
return
self
.
getresp
()
return
self
.
getresp
()
def
longcmd
(
self
,
line
,
file
Handle
=
None
):
def
longcmd
(
self
,
line
,
file
=
None
):
"""Internal: send a command and get the response plus following text."""
"""Internal: send a command and get the response plus following text."""
self
.
putcmd
(
line
)
self
.
putcmd
(
line
)
return
self
.
getlongresp
(
file
Handle
)
return
self
.
getlongresp
(
file
)
def
newgroups
(
self
,
date
,
time
):
def
newgroups
(
self
,
date
,
time
):
"""Process a NEWGROUPS command. Arguments:
"""Process a NEWGROUPS command. Arguments:
...
@@ -355,9 +355,9 @@ class NNTP:
...
@@ -355,9 +355,9 @@ class NNTP:
"""Process a LAST command. No arguments. Return as for STAT."""
"""Process a LAST command. No arguments. Return as for STAT."""
return
self
.
statcmd
(
'LAST'
)
return
self
.
statcmd
(
'LAST'
)
def
artcmd
(
self
,
line
,
file
Handle
=
None
):
def
artcmd
(
self
,
line
,
file
=
None
):
"""Internal: process a HEAD, BODY or ARTICLE command."""
"""Internal: process a HEAD, BODY or ARTICLE command."""
resp
,
list
=
self
.
longcmd
(
line
,
fileHand
le
)
resp
,
list
=
self
.
longcmd
(
line
,
fi
le
)
resp
,
nr
,
id
=
self
.
statparse
(
resp
)
resp
,
nr
,
id
=
self
.
statparse
(
resp
)
return
resp
,
nr
,
id
,
list
return
resp
,
nr
,
id
,
list
...
@@ -372,18 +372,18 @@ class NNTP:
...
@@ -372,18 +372,18 @@ class NNTP:
return
self
.
artcmd
(
'HEAD '
+
id
)
return
self
.
artcmd
(
'HEAD '
+
id
)
def
body
(
self
,
id
,
file
Handle
=
None
):
def
body
(
self
,
id
,
file
=
None
):
"""Process a BODY command. Argument:
"""Process a BODY command. Argument:
- id: article number or message id
- id: article number or message id
- file
Handle
: Filename string or file object to store the article in
- file: Filename string or file object to store the article in
Returns:
Returns:
- resp: server response if successful
- resp: server response if successful
- nr: article number
- nr: article number
- id: message id
- id: message id
- list: the lines of the article's body or an empty list
- list: the lines of the article's body or an empty list
if file
Handle
was used"""
if file was used"""
return
self
.
artcmd
(
'BODY '
+
id
,
file
Handle
)
return
self
.
artcmd
(
'BODY '
+
id
,
file
)
def
article
(
self
,
id
):
def
article
(
self
,
id
):
"""Process an ARTICLE command. Argument:
"""Process an ARTICLE command. Argument:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment