Skip to content

Commit df08e65

Browse files
committed
To support development without having to install Mailman, make the import of mailman list info conditional on mailman module imports succeeding.
- Legacy-Id: 11426
1 parent ef8da52 commit df08e65

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

ietf/mailinglists/management/commands/import_mailman_listinfo.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010

1111
sys.path.append(settings.MAILMAN_LIB_DIR)
1212

13-
from Mailman import Utils
14-
from Mailman import MailList
15-
from Mailman import MemberAdaptor
13+
have_mailman = False
14+
try:
15+
from Mailman import Utils
16+
from Mailman import MailList
17+
from Mailman import MemberAdaptor
18+
have_mailman = True
19+
except ImportError:
20+
pass
1621

1722
from ietf.mailinglists.models import List, Subscribed
1823

@@ -22,6 +27,10 @@ def note(msg):
2227
sys.stdout.write(msg)
2328
sys.stdout.write('\n')
2429

30+
if not have_mailman:
31+
note("Could not import mailman modules -- skipping import of mailman list info")
32+
return
33+
2534
for name in Utils.list_names():
2635
mlist = MailList.MailList(name, lock=False)
2736
note("List: %s" % mlist.internal_name())

0 commit comments

Comments
 (0)