C Nulk wrote:
>
>I am posting the matches_p function below. I believe the problem is an
>off-shoot of the lce/cpe problem with the LDAPMembership adapter you
>helped me with earlier. I did get it to work by changing the condition
>in matches_p from
>
> if mother.members.has_key(sender):
>to
> if mother.isMember(sender):
The change you made is correct. The problem is I think I referred you
to the original listinclusion.patch from
<http://sourceforge.net/tracker/index.php?func=detail&aid=1220144&group_id=103&atid=300103>,
and that patch has problems when the MemberAdaptor is other than the
default OldStyleMemberships.py.
The current Moderate.matches_p() is attached as matches_p.txt for your
reference.
[...]
>Is the change I made the correct way of fixing the problem? If so,
>should other places where 'mlist.members.has_key(variable)' also be changed?
I don't know where else you are seeing mlist.members.has_key(variable),
but the only place anything like that should be referenced is in
OldStyleMemberships.py. Anywhere in the code at large where there is a
membership test it should be via the list's isMember() method which
will determine membership via the appropriate MemberAdaptor.
>I have also added the 'accept_special_posters' attribute I mentioned on
>the Mailman-users list. Can you take at least a quick look at the
>changes to make sure I didn't mess things up to bad? I have the diffs
>for MailList.py, versions.py, Version.py, Gui/Privacy.py and
>Handler/Moderate.py.
Yes, I can look at them.
--
Mark Sapiro <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
def matches_p(sender, nonmembers, listname):
# First strip out all the regular expressions and listnames
plainaddrs = [addr for addr in nonmembers if not (addr.startswith('^')
or addr.startswith('@'))]
addrdict = Utils.List2Dict(plainaddrs, foldcase=1)
if addrdict.has_key(sender):
return 1
# Now do the regular expression matches
for are in nonmembers:
if are.startswith('^'):
try:
cre = re.compile(are, re.IGNORECASE)
except re.error:
continue
if cre.search(sender):
return 1
elif are.startswith('@'):
# XXX Needs to be reviewed for l...@domain names.
try:
if are[1:] == listname:
# don't reference your own list
syslog('error',
'*_these_nonmembers in %s references own list',
listname)
else:
mother = MailList(are[1:], lock=0)
if mother.isMember(sender):
return 1
except Errors.MMUnknownListError:
syslog('error',
'*_these_nonmembers in %s references non-existent list %s',
listname, are[1:])
return 0
_______________________________________________
Mailman-Developers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy: http://wiki.list.org/x/QIA9