Merge lp:~raj-abhilash1/mailman/bugfix into lp:mailman

Proposed by Abhilash Raj
Status: Merged
Merged at revision: 7318
Proposed branch: lp:~raj-abhilash1/mailman/bugfix
Merge into: lp:mailman
Diff against target: 42 lines (+13/-1)
2 files modified
src/mailman/rest/domains.py (+4/-1)
src/mailman/rest/tests/test_domains.py (+9/-0)
To merge this branch: bzr merge lp:~raj-abhilash1/mailman/bugfix
Reviewer Review Type Date Requested Status
Mailman Coders Pending
Review via email: mp+256233@code.launchpad.net

Description of the change

When creating domain with single owner passed via json, InvalidEmailError was raise. Fixed that.

To post a comment you must log in.
lp:~raj-abhilash1/mailman/bugfix updated
7317. By Barry Warsaw

 * Mailing list subscription policy work flow has been completely rewritten.
   It now properly supports email verification and subscription confirmation
   by the user, and approval by the moderator using unique tokens.
   ``IMailingList`` objects now have a ``subscription_policy`` attribute.

7318. By Barry Warsaw

Abhilash's fix for allowing singleton strings in REST interfaces that also
accept lists of strings.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/mailman/rest/domains.py'
--- src/mailman/rest/domains.py 2015-04-07 01:39:34 +0000
+++ src/mailman/rest/domains.py 2015-04-14 21:33:34 +0000
@@ -118,7 +118,10 @@
118 # but .add() requires an `owners` keyword. Match impedence.118 # but .add() requires an `owners` keyword. Match impedence.
119 owners = values.pop('owner', None)119 owners = values.pop('owner', None)
120 if owners is not None:120 if owners is not None:
121 values['owners'] = owners121 if isinstance(owners, str):
122 values['owners'] = [owners]
123 else:
124 values['owners'] = owners
122 domain = domain_manager.add(**values)125 domain = domain_manager.add(**values)
123 except BadDomainSpecificationError as error:126 except BadDomainSpecificationError as error:
124 bad_request(response, str(error))127 bad_request(response, str(error))
125128
=== modified file 'src/mailman/rest/tests/test_domains.py'
--- src/mailman/rest/tests/test_domains.py 2015-04-07 02:06:28 +0000
+++ src/mailman/rest/tests/test_domains.py 2015-04-14 21:33:34 +0000
@@ -54,6 +54,14 @@
54 'http://localhost:9001/3.0/domains', data, method="POST")54 'http://localhost:9001/3.0/domains', data, method="POST")
55 self.assertEqual(response.status, 201)55 self.assertEqual(response.status, 201)
5656
57 def test_domain_create_with_single_owner(self):
58 # Creating domain with single owner should not raise InvalidEmailError
59 content, response = call_api('http://localhost:9001/3.0/domains',
60 dict(mail_host='example.in',
61 owner='someperson@example.com'),
62 method='POST')
63 self.assertEqual(response.status, 201)
64
57 def test_bogus_endpoint_extension(self):65 def test_bogus_endpoint_extension(self):
58 # /domains/<domain>/lists/<anything> is not a valid endpoint.66 # /domains/<domain>/lists/<anything> is not a valid endpoint.
59 with self.assertRaises(HTTPError) as cm:67 with self.assertRaises(HTTPError) as cm:
@@ -102,6 +110,7 @@
102 self.assertEqual(cm.exception.code, 404)110 self.assertEqual(cm.exception.code, 404)
103111
104112
113
105114
106115
107class TestDomainOwners(unittest.TestCase):116class TestDomainOwners(unittest.TestCase):
108 layer = RESTLayer117 layer = RESTLayer