def get_from_email(self): return build_command_address(self.mailing_list, 'bounce')
def list_command(mailing_list, command): """Returns the address for accessing the given list command, if such a command exists. Otherwise returns an empty string.""" try: return build_command_address(mailing_list, command) except ValueError: return ''
def test_build_command_address(self): site = Site.objects.create(name="there", domain="there.com") mailing_list = MailingList(local_part="hi", domain=site) self.assertEqual(build_command_address(mailing_list, "subscribe"), "*****@*****.**") self.assertRaises(ValueError, build_command_address, mailing_list, "raid")