Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cc0f9323
Kaydet (Commit)
cc0f9323
authored
Tem 26, 2004
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #605370: Add description[s] for RFC 2980 compliance.
üst
32d0c1b4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
0 deletions
+60
-0
libnntplib.tex
Doc/lib/libnntplib.tex
+20
-0
nntplib.py
Lib/nntplib.py
+36
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libnntplib.tex
Dosyayı görüntüle @
cc0f9323
...
...
@@ -175,6 +175,23 @@ then the method will open a file object with that name, write to it
then close it. If
\var
{
file
}
is a file object, then it will start
calling
\method
{
write()
}
on it to store the lines of the command output.
If
\var
{
file
}
is supplied, then the returned
\var
{
list
}
is an empty list.
\begin{methoddesc}
{
descriptions
}{
grouppattern
}
Send a
\samp
{
LIST NEWSGROUPS
}
command, where
\var
{
grouppattern
}
is a wildmat
string as specified in RFC2980 (it's essentially the same as DOS or UNIX
shell wildcard strings). Return a pair
\code
{
(
\var
{
response
}
,
\var
{
list
}
)
}
, where
\var
{
list
}
is a list of tuples containing
\code
{
(
\var
{
name
}
,
\var
{
title
}
)
}
.
\end{methoddesc}
\begin{methoddesc}
{
description
}{
group
}
Get a description for a single group
\var
{
group
}
. If more than one group
matches (if 'group' is a real wildmat string), return the first match. If no group
matches, return an empty string.
This elides the response code from the server. If the response code is
needed, use
\method
{
descriptions()
}
.
\end{methoddesc}
\begin{methoddesc}
{
group
}{
name
}
...
...
@@ -294,6 +311,9 @@ calling \method{write()} on it to store the lines of the command output.
If
\var
{
file
}
is supplied, then the returned
\var
{
list
}
is an empty list.
This is an optional NNTP extension, and may not be supported by all
servers.
RFC2980 says ``It is suggested that this extension be deprecated''. Use
\method
{
descriptions()
}
or
\method
{
description()
}
instead.
\end{methoddesc}
\begin{methoddesc}
{
xover
}{
start, end,
\optional
{
file
}}
...
...
Lib/nntplib.py
Dosyayı görüntüle @
cc0f9323
...
...
@@ -297,6 +297,42 @@ class NNTP:
list
[
i
]
=
tuple
(
list
[
i
]
.
split
())
return
resp
,
list
def
description
(
self
,
group
):
"""Get a description for a single group. If more than one
group matches ('group' is a pattern), return the first. If no
group matches, return an empty string.
This elides the response code from the server, since it can
only be '215' or '285' (for xgtitle) anyway. If the response
code is needed, use the 'descriptions' method.
NOTE: This neither checks for a wildcard in 'group' nor does
it check whether the group actually exists."""
resp
,
lines
=
self
.
descriptions
(
group
)
if
len
(
lines
)
==
0
:
return
""
else
:
return
lines
[
0
][
1
]
def
descriptions
(
self
,
group_pattern
):
"""Get descriptions for a range of groups."""
line_pat
=
re
.
compile
(
"^(?P<group>[^
\t
]+)[
\t
]+(.*)$"
)
# Try the more std (acc. to RFC2980) LIST NEWSGROUPS first
resp
,
raw_lines
=
self
.
longcmd
(
'LIST NEWSGROUPS '
+
group_pattern
)
if
resp
[:
3
]
!=
"215"
:
# Now the deprecated XGTITLE. This either raises an error
# or succeeds with the same output structure as LIST
# NEWSGROUPS.
resp
,
raw_lines
=
self
.
longcmd
(
'XGTITLE '
+
group_pattern
)
lines
=
[]
for
raw_line
in
raw_lines
:
match
=
line_pat
.
search
(
raw_line
.
strip
())
if
match
:
lines
.
append
(
match
.
group
(
1
,
2
))
return
resp
,
lines
def
group
(
self
,
name
):
"""Process a GROUP command. Argument:
- group: the group name
...
...
Misc/ACKS
Dosyayı görüntüle @
cc0f9323
...
...
@@ -163,6 +163,7 @@ David Ely
Jeff Epler
Tom Epperly
Stoffel Erasmus
Jrgen A. Erhard
Michael Ernst
Ben Escoto
Andy Eskilsson
...
...
Misc/NEWS
Dosyayı görüntüle @
cc0f9323
...
...
@@ -44,6 +44,9 @@ Extension modules
Library
-------
-
nntplib
has
two
new
methods
:
description
and
descriptions
.
They
use
a
more
RFC
-
compliant
way
of
getting
a
newsgroup
description
.
-
Bug
#
993394.
Fix
a
possible
red
herring
of
KeyError
in
'threading'
being
raised
during
interpreter
shutdown
from
a
registered
function
with
atexit
when
dummy_threading
is
being
used
.
...
...
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