"""List the contents of subscribe_auto_approval, ban_list and *_these_nonmembers for a list or lists. Save as bin/list_etc.py Run via bin/withlist -r list_etc to do a single list or bin/withlist -a -r list_etc to do all lists. """ def usage(code, msg=''): if code: fd = sys.stderr else: fd = sys.stdout print >> fd, __doc__ if msg: print >> fd, msg sys.exit(code) def list_etc(mlist): print('List:%s' % mlist.real_name) for attr in ['subscribe_auto_approval', 'ban_list', 'accept_these_nonmembers', 'hold_these_nonmembers', 'reject_these_nonmembers', 'discard_these_nonmembers', ]: alist = getattr(mlist, attr, None) if alist: print(' %s:' % attr) for val in alist: print(' %s' % val)