diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-04 21:36:15 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-11-04 21:36:15 (GMT) |
commit | 08eeadac277982f3e4a501a976e035be6c0ef83c (patch) | |
tree | 073b31da7f9e4028e6d1f9f6a277bc543a98f26c /Lib/nntplib.py | |
parent | 99c4830d0cbd7ef876f178d4988da86956c39849 (diff) | |
download | cpython-08eeadac277982f3e4a501a976e035be6c0ef83c.zip cpython-08eeadac277982f3e4a501a976e035be6c0ef83c.tar.gz cpython-08eeadac277982f3e4a501a976e035be6c0ef83c.tar.bz2 |
Issue #10283: Add a `group_pattern` argument to NNTP.list().
Diffstat (limited to 'Lib/nntplib.py')
-rw-r--r-- | Lib/nntplib.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/nntplib.py b/Lib/nntplib.py index fde339a..d5786e2 100644 --- a/Lib/nntplib.py +++ b/Lib/nntplib.py @@ -571,14 +571,19 @@ class _NNTPBase: cmd = 'NEWNEWS {0} {1} {2}'.format(group, date_str, time_str) return self._longcmdstring(cmd, file) - def list(self, *, file=None): - """Process a LIST command. Argument: + def list(self, group_pattern=None, *, file=None): + """Process a LIST or LIST ACTIVE command. Arguments: + - group_pattern: a pattern indicating which groups to query - file: Filename string or file object to store the result in Returns: - resp: server response if successful - list: list of (group, last, first, flag) (strings) """ - resp, lines = self._longcmdstring('LIST', file) + if group_pattern is not None: + command = 'LIST ACTIVE ' + group_pattern + else: + command = 'LIST' + resp, lines = self._longcmdstring(command, file) return resp, self._grouplist(lines) def _getdescriptions(self, group_pattern, return_all): |