#! /opt/mailman/mm/venv/bin/python
# Copyright (C) 2024 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see .
"""Print all the attribute values of a list."""
import sys
import argparse
from mailman.core import initialize
from mailman.core.i18n import _
from mailman.interfaces.listmanager import IListManager
from zope.component import getUtility
initialize.initialize()
parser = argparse.ArgumentParser(
description = __doc__
)
parser.add_argument('listspec',
type=str,
help="""\
The list_id or posting address of the list to use.
""")
parser.add_argument('-s', '--show_rosters',
dest='show_rosters', action='store_true',
help="""\
By default the contents of rosters are not shown as they can be quite long.
Specify this to show them.
""")
def main():
args = parser.parse_args()
listspec=args.listspec
mlist = getUtility(IListManager).get(listspec)
if mlist is None:
print(_('No such list: ${listspec}'), file = sys.stderr)
sys.exit(1)
print(_('Settings for list ${listspec}\n'))
for name in dir(mlist):
if not name.startswith('_'):
value = getattr(mlist, name, '')
if repr(type(value)) == "":
value = list(value)
elif repr(type(value)).startswith("":
continue
elif repr(type(value)).startswith("