Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core


Commits:
f08f4cd8 by Ngalim Siregar at 2021-04-21T10:08:07+07:00
[#872] Return more usable error message for REST response

- - - - -
76fd3434 by Abhilash Raj at 2021-08-21T18:03:54+00:00
Merge branch 'chores/usable-error-message-for-bad-email-address-872' 
into 'master'

Return more usable error message for REST response

Closes #872

See merge request mailman/mailman!839
- - - - -


2 changed files:

- src/mailman/rest/tests/test_users.py
- src/mailman/rest/users.py


Changes:

=====================================
src/mailman/rest/tests/test_users.py
=====================================
@@ -245,7 +245,9 @@ class TestUsers(unittest.TestCase):
                 email='anne@invalid'))
         # There is now one user.
         self.assertEqual(cm.exception.code, 400)
-        self.assertEqual(cm.exception.reason, 'anne@invalid')
+        self.assertEqual(
+            cm.exception.reason,
+            'Invalid email address anne@invalid')
 
     def test_create_server_owner_false(self):
         # Issue #136: Creating a user with is_server_owner=no should create


=====================================
src/mailman/rest/users.py
=====================================
@@ -163,7 +163,8 @@ class AllUsers(_UserBase):
             arguments = validator(request)
             create_user(self.api, arguments, response)
         except (ValueError, InvalidEmailAddressError) as error:
-            bad_request(response, str(error))
+            error_message = 'Invalid email address {}'.format(error)
+            bad_request(response, error_message)
             return
 
 



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/d3cc41da55bc40623514e5a72eda64e662a3eb53...76fd34342731cb15b886cd770ba5167bd5afda8c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/d3cc41da55bc40623514e5a72eda64e662a3eb53...76fd34342731cb15b886cd770ba5167bd5afda8c
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to