[Mailman-Developers] Clean output with bin/withlist??

Barry A. Warsaw barry@zope.com
Wed, 1 Aug 2001 02:29:38 -0400


>>>>> "SB" == Scott Brown <scott-brown@home.com> writes:

    SB> How do I __cleanly__ get the "prefered domain" that is
    SB> associated with a given list?

    SB> I'm sure this is possible with the "withlist"... and it's the
    SB> "host_name" attribute I want (isnt it??)

Correct.
    
    SB> .... which if I understand the docs is a member of the "m"
    SB> collection (is that the right name under Python??)

To be pedantic :) "m" is a module global variable bound to an instance
of the MailList class.  Or simpler: "m" is a mailing list object.

    SB> My question is how do I actually extract that (preferably as a
    SB> one liner without a pile of other output, such that I can pull
    SB> it into a perl script and use it without a lot of additional
    SB> processing)

Put this in $prefix/bin/hostname.py:

-------------------- snip snip --------------------
def hostname(m):
    print m.host_name
-------------------- snip snip --------------------

and run with

% bin/withlist -q -r hostname mylist
wooz.org

The Perl goo is up to you!

Of course...

    SB> With 2.1 soon to be released (nudge nudge) maybe it's still
    SB> within the timeframe for producing this wee little
    SB> change... (otherwise I'll have to try to hack a quiet flag in
    SB> there... maybe... if I'm lucky :)

...you're lucky I'm feeling insomniatic today.  -q is a good idea,
easy to add, and checked into cvs two minutes from now. :)

-Barry