~sambuddhabasu1/mailman/fix_mailman_run_error

« back to all changes in this revision

Viewing changes to src/attic/cmd_lists.py

  • Committer: Barry Warsaw
  • Date: 2015-03-03 02:34:09 UTC
  • mfrom: (7299.1.1 mailman_trunk)
  • Revision ID: barry@list.org-20150303023409-g7qqejbizzouc85k
Doc fixes given by Abhilash Raj.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2002-2009 by the Free Software Foundation, Inc.
2
 
#
3
 
# This file is part of GNU Mailman.
4
 
#
5
 
# GNU Mailman is free software: you can redistribute it and/or modify it under
6
 
# the terms of the GNU General Public License as published by the Free
7
 
# Software Foundation, either version 3 of the License, or (at your option)
8
 
# any later version.
9
 
#
10
 
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
 
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13
 
# more details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License along with
16
 
# GNU Mailman.  If not, see <http://www.gnu.org/licenses/>.
17
 
 
18
 
"""
19
 
    lists
20
 
        See a list of the public mailing lists on this GNU Mailman server.
21
 
"""
22
 
 
23
 
from mailman.MailList import MailList
24
 
from mailman.config import config
25
 
from mailman.i18n import _
26
 
 
27
 
 
28
 
STOP = 1
29
 
 
30
 
 
31
 
 
32
 
def gethelp(mlist):
33
 
    return _(__doc__)
34
 
 
35
 
 
36
 
 
37
 
def process(res, args):
38
 
    mlist = res.mlist
39
 
    if args:
40
 
        res.results.append(_('Usage:'))
41
 
        res.results.append(gethelp(mlist))
42
 
        return STOP
43
 
    hostname = mlist.host_name
44
 
    res.results.append(_('Public mailing lists at %(hostname)s:'))
45
 
    i = 1
46
 
    for listname in sorted(config.list_manager.names):
47
 
        if listname == mlist.internal_name():
48
 
            xlist = mlist
49
 
        else:
50
 
            xlist = MailList(listname, lock=0)
51
 
        # We can mention this list if you already know about it
52
 
        if not xlist.advertised and xlist is not mlist:
53
 
            continue
54
 
        # Skip the list if it isn't in the same virtual domain.
55
 
        if xlist.host_name <> mlist.host_name:
56
 
            continue
57
 
        realname = xlist.real_name
58
 
        description = xlist.description or _('n/a')
59
 
        requestaddr = xlist.GetRequestEmail()
60
 
        if i > 1:
61
 
            res.results.append('')
62
 
        res.results.append(_('%(i)3d. List name:   %(realname)s'))
63
 
        res.results.append(_('     Description: %(description)s'))
64
 
        res.results.append(_('     Requests to: %(requestaddr)s'))
65
 
        i += 1