I think this is a real bug. I think you're right that a new
ListDeletingEvent should be added to clear out any aliases for the
mailing list. I actually tried to write a test for this in
src/mailman/model/tests/test_mailinglist.py but the
AceptableAliasSet.add() method doesn't seem to add the record to the
acceptablealias table.
class TestAcceptableAliases(unittest.TestCase):
layer = ConfigLayer
def setUp(self):
self._mlist = create_list('[email protected]')
def test_delete_list_with_acceptable_aliases(self):
# LP: #1432239 - deleting a mailing list with acceptable aliases
# causes a SQLAlchemy error. The aliases must be deleted first.
alias_set = IAcceptableAliasSet(self._mlist)
alias_set.add('[email protected]')
self.assertEqual(['[email protected]'],
[alias.alias for alias in alias_set.aliases])
getUtility(IListManager).delete(self._mlist)
self.assertEqual(len(alias.alias for alias in alias_set.aliases), 0)
$ .tox/py34/bin/python -m nose2 -P test_delete_list_with_acceptable_aliases
F
======================================================================
FAIL: test_delete_list_with_acceptable_aliases
(mailman.model.tests.test_mailinglist.TestAcceptableAliases)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/barry/projects/mailman/lp1432239/src/mailman/model/tests/test_mailinglist.py",
line 162, in test_delete_list_with_acceptable_aliases
[alias.alias for alias in alias_set.aliases])
AssertionError: Lists differ: ['[email protected]'] != []
First list contains 1 additional elements.
First extra element 0:
[email protected]
- ['[email protected]']
+ []
----------------------------------------------------------------------
Ran 1 test in 0.173s
FAILED (failures=1)
I'd rather not add an explicit commit here because IIUC, it isn't necessary in
other model layer tests. I think if the test can be made to fail, the fix
should be easy.
** Changed in: mailman
Status: New => Triaged
** Changed in: mailman
Milestone: None => 3.0.0b6
--
You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.
https://bugs.launchpad.net/bugs/1432239
Title:
Lists cannot be deleted if the have acceptable alias records
To manage notifications about this bug go to:
https://bugs.launchpad.net/mailman/+bug/1432239/+subscriptions
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders