Skip to content

Commit 0ac80ab

Browse files
committed
Fixed 2 bugs in import_mailman_listinfo; one typo and one bug which prevented updating of lists that changed from advertised to not advertised.
- Legacy-Id: 14600
1 parent a1ad261 commit 0ac80ab

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

ietf/mailinglists/management/commands/import_mailman_listinfo.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,19 @@ def note(msg):
3737
for name in names:
3838
mlist = MailList.MailList(name, lock=False)
3939
note("List: %s" % mlist.internal_name())
40-
sys.exit()
40+
41+
description = mlist.description.decode('latin1')[:256]
42+
lists = List.objects.filter(name=mlist.real_name)
43+
if lists.count() > 1:
44+
# Arbitrary choice; we'll update the remaining item next
45+
for item in lists[1:]:
46+
item.delete()
47+
mmlist, created = List.objects.get_or_create(name=mlist.real_name)
48+
mmlist.description = description
49+
mmlist.advertised = mlist.advertised
50+
mmlist.save()
51+
# The following calls return lowercased addresses
4152
if mlist.advertised:
42-
description = mlist.description.decode('latin1')[:256]
43-
mmlist, created = List.objects.get_or_create(name=mlist.real_name)
44-
mmlist.description = description
45-
mmlist.advertised = mlist.advertised
46-
mmlist.save()
47-
# The following calls return lowercased addresses
4853
members = mlist.getRegularMemberKeys() + mlist.getDigestMemberKeys()
4954
members = [ m for m in members if mlist.getDeliveryStatus(m) == MemberAdaptor.ENABLED ]
5055
known = Subscribed.objects.filter(lists__name=name).values_list('email', flat=True)

0 commit comments

Comments
 (0)