#! /usr/bin/env python

#
# Written by Craig Kelley -- fall, 2000
#

"""Return a mailing list's owner's email address

This script gets called by the classmail perl program.

argv[1] is the name of the mailing list whose owner(s) we need
"""

import sys
import paths
from Mailman import MailList
from Mailman import Message
from Mailman.Logging.StampedLogger import StampedLogger

try:
    sys.stderr = StampedLogger("error", label = 'post',
                               manual_reprime=1, nofail=0)
except IOError:
    pass                        # Oh well - SOL on redirect, errors show thru.

# Only let one program per list run at any one time.  TBD: This *can* fail,
# and should send back an error message when it does.
for listname in sys.argv[1:(len(sys.argv))]:
    mlist = MailList.MailList(listname)
    try:
        print listname, mlist.owner
        # Let another process run.
    finally:
        mlist.Unlock()
    

