[Mailman-Developers] Re: External subscriber lists in 2.1
Fri, 23 Aug 2002 17:31:46 -0400 (EDT)
On Tue, 20 Aug 2002, Barry A. Warsaw wrote:
> Yes. Mailman 2.1 will work with Python 2.1.3 and beyond. The next
> version will require at least Python 2.2.1. So if you want to also
> support Py2.1, iterators and generators are out.
Right. That's probably a good enough reason to not even attempt getting
this in to Mailman2.1 (but I would like to eventually see it in Mailman
rather than a patch, as patches suffer from bit-rot quickly in systems
undergoing active development).
> len(iterator) doesn't work (unfortunately, IMO). So maybe we're screwed
> because we'd have to call list() on the thing to be able to give it to
Or have another way to not ask for the data from the MemberAdaptor, but
rather ask for the number of data items. (So we never need to call len()
on the results.)
> OTOH, if the iterator object we return has an __len__() method, we
> should be okay.
That's not a bad idea, but might make cause portability problems down the
> | def getNumMembers(self, type, status, options, regexp=None):
> | """Get the number of members of this mailing list matching type and
> | status, and optionally matching the regular expression passed in.
> Would it be good enough to do something like the following:
> def getMatchingMembers(self, func):
> """Return a list of members for which function evaluates true.
> For each member in the database, call func(), passing in the
> member's subscribed address. If func() returns true, the address
> is included in the returned list.
I don't want to have to pull the data for every possible match into Python
to decide whether it should be included--I want to be able to ask the DB
to decide that for us given specific constraints.
> OTOH, it might be too flexible (it'd be hard to run this in a database
> or translate to selects, etc.)
> so I'm willing to be persuaded.
I'd like to present to this function all the relevant information so that
it can decide internally who matches and who does not. The API I designed
does fit that bill, although I'm certain it's probably not ideal. Please
offer suggestions if there's anything in there that you'd like to see
changed. For now I'll just run with what I've got.
> Also getMatchingMembers() would have to return a list for Py2.1
> compatibility, but could return an iterator or generator in Py2.2+.
While I hope few mailing lists have millions of subscribers, since we'd
like this tool to be able to handle that, I think I'm going to use
iterators/generators (now I have to go learn about them! :-). If you
think it's important to have this work w/Py2.1, I am willing to be