Mark Sapiro wrote:
>
>Presumably this is a withlist script. I would make the following
>change, but it may not help:
>
>@@ -1,3 +1,4 @@
>+import sys
> from Mailman.Errors import NotAMemberError
> from Mailman import mm_cfg
> from os.path import isfile
>@@ -7,7 +8,11 @@
> if isfile('vawupdate/scripts/vaw_wcp.txt'):
> whoCanPostListsVAWFile = open('vawupdate/scripts/vaw_wcp.txt', 'r')
> for line in whoCanPostListsVAWFile:
>- whoCanPostListsData.append(line.strip().split("/"))
>+ entry = line.strip().split("/")
>+ if len(entry) <> 3 or entry[2] not in ('0', '1'):
>+ print >> sys.stderr, 'Skipping invalid entry: %s' % str(entry)
>+ continue
>+ whoCanPostListsData.append(entry)
>
> def wcpupdate(mlist):
> global whoCanPostListsData
Looking more closely, I would do the following (I was initially thrown
off by the import of NotAMemberError - I didn't notice you didn't use
it)
@@ -1,3 +1,4 @@
+import sys
from Mailman.Errors import NotAMemberError
from Mailman import mm_cfg
from os.path import isfile
@@ -7,7 +8,11 @@
if isfile('vawupdate/scripts/vaw_wcp.txt'):
whoCanPostListsVAWFile = open('vawupdate/scripts/vaw_wcp.txt', 'r')
for line in whoCanPostListsVAWFile:
- whoCanPostListsData.append(line.strip().split("/"))
+ entry = line.strip().split("/")
+ if len(entry) <> 3 or entry[2] not in ('0', '1'):
+ print >> sys.stderr, 'Skipping invalid entry: %s' % str(entry)
+ continue
+ whoCanPostListsData.append(entry)
def wcpupdate(mlist):
global whoCanPostListsData
@@ -15,10 +20,16 @@
mlist.Lock()
for whoCanPostLine in whoCanPostListsData:
if mlist.internal_name()==whoCanPostLine[0]:
- if whoCanPostLine[2]=='0':
- mlist.setMemberOption(whoCanPostLine[1].strip(),
mm_cfg.Moderate, mm_cfg.No)
- else:
- mlist.setMemberOption(whoCanPostLine[1].strip(),
mm_cfg.Moderate, mm_cfg.Yes)
- print whoCanPostLine[1], ' set'
+ try:
+ if whoCanPostLine[2]=='0':
+ mlist.setMemberOption(whoCanPostLine[1].strip(),
+ mm_cfg.Moderate, mm_cfg.No)
+ else:
+ mlist.setMemberOption(whoCanPostLine[1].strip(),
+ mm_cfg.Moderate, mm_cfg.Yes)
+ print whoCanPostLine[1], ' set'
+ except NotAMemberError:
+ print >> sys.stderr, '%s: not in %s' % (whoCanPostLine[1],
+ whoCanPostLine[0])
mlist.Save()
mlist.Unlock()
--
Mark Sapiro <[EMAIL PROTECTED]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org
Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp