Exemple #1
0
 def on_delete(self, request, response):
     """Delete the named mailing list."""
     if self._mlist is None:
         not_found(response)
     else:
         remove_list(self._mlist)
         no_content(response)
Exemple #2
0
 def on_delete(self, request, response):
     """Delete the named mailing list."""
     if self._mlist is None:
         not_found(response)
     else:
         remove_list(self._mlist)
         no_content(response)
Exemple #3
0
def remove(quiet, listspec):
    mlist = getUtility(IListManager).get(listspec)
    if mlist is None:
        if not quiet:
            print(_('No such list matching spec: $listspec'))
            sys.exit(0)
    with transaction():
        remove_list(mlist)
        if not quiet:
            print(_('Removed list: $listspec'))
Exemple #4
0
 def process(self, args):
     """See `ICLISubCommand`."""
     def log(message):
         if not args.quiet:
             print(message)
     assert len(args.listname) == 1, (
         'Unexpected positional arguments: %s' % args.listname)
     fqdn_listname = args.listname[0]
     mlist = getUtility(IListManager).get(fqdn_listname)
     if mlist is None:
         log(_('No such list: $fqdn_listname'))
         return
     else:
         log(_('Removed list: $fqdn_listname'))
     remove_list(mlist)
Exemple #5
0
 def process(self, args):
     """See `ICLISubCommand`."""
     def log(message):
         if not args.quiet:
             print(message)
     assert len(args.listname) == 1, (
         'Unexpected positional arguments: %s' % args.listname)
     fqdn_listname = args.listname[0]
     mlist = getUtility(IListManager).get(fqdn_listname)
     if mlist is None:
         log(_('No such list: $fqdn_listname'))
         return
     else:
         log(_('Removed list: $fqdn_listname'))
     remove_list(mlist)
    def test_process_bounce_event(self):
        # Test that we are able to process bounce events.
        self._subscribe_and_add_bounce_event('*****@*****.**',
                                             subscribe=False)
        events = list(self._processor.unprocessed)
        self.assertEqual(len(events), 1)
        # If the associated email with the event is not a member of the
        # MailingList, an InvalidBounceEvent exception is raised.
        with self.assertRaises(InvalidBounceEvent):
            self._processor.process_event(events[0])
        # Now, we will subscribe the user and see if we can process the event
        # further and add another bounce event for anne.
        self._subscribe_and_add_bounce_event('*****@*****.**', create=False)
        events = list(self._processor.unprocessed)
        self.assertEqual(len(events), 1)

        member = self._mlist.members.get_member('*****@*****.**')
        self.assertTrue(member is not None)

        self._processor.process_event(events[0])
        # Now, we should be able to check the bounce score of anne.
        self.assertEqual(member.bounce_score, 1)
        self.assertIsNotNone(member.last_bounce_received)
        # Also, the delivery should be unset, the default.
        self.assertIsNone(member.preferences.delivery_status)

        # Now create another event for Anne.
        self._subscribe_and_add_bounce_event('*****@*****.**',
                                             create=False,
                                             subscribe=False)
        # Now delete the list and process the bounce for the non-existent list.
        remove_list(self._mlist)
        events = list(self._processor.unprocessed)
        self.assertEqual(len(events), 1)
        # If the MailingList has been deleted, an InvalidBounceEvent exception
        # is raised.
        with self.assertRaises(InvalidBounceEvent):
            self._processor.process_event(events[0])
Exemple #7
0
 def test_remove_list_without_data_path(self):
     mlist = create_list('*****@*****.**')
     shutil.rmtree(mlist.data_path)
     remove_list(mlist)
     self.assertIsNone(getUtility(IListManager).get('*****@*****.**'))
Exemple #8
0
 def delete_list(self, request):
     """Delete the named mailing list."""
     if self._mlist is None:
         return http.not_found()
     remove_list(self._mlist)
     return no_content()
Exemple #9
0
 def tearDown(self):
     remove_list(self._mlist)
Exemple #10
0
 def test_remove_list_without_data_path(self):
     mlist = create_list('*****@*****.**')
     shutil.rmtree(mlist.data_path)
     remove_list(mlist)
     self.assertIsNone(getUtility(IListManager).get('*****@*****.**'))
Exemple #11
0
 def tearDown(self):
     remove_list(self._mlist.fqdn_listname, self._mlist)