Commit 30e2b86c authored by Abhilash Raj's avatar Abhilash Raj

Merge branch 'fix-153' into 'master'

Return 404 instead of 500 if member doesn't exist

Fixes #153

See merge request !177
parents 466a5653 5307e5b4
Pipeline #4320051 passed with stage
in 2 minutes and 35 seconds
......@@ -91,6 +91,13 @@ class ListMembersOptionsTest(ViewTestCase):
self.assertIsInstance(response.context['preferences_form'],
UserPreferences)
def test_nonexistent_member_returns_404(self):
self.client.login(username='testsu', password='testpass')
url = reverse('list_member_options', args=(self.foo_list.list_id,
'none@example.com',))
response = self.client.get(url)
self.assertEquals(response.status_code, 404)
def test_moderation_action(self):
self.assertIsNone(
self.foo_list.get_member('test@example.com').moderation_action)
......
......@@ -137,6 +137,8 @@ def list_member_options(request, list_id, email):
try:
mm_member = client.get_member(list_id, email)
member_prefs = mm_member.preferences
except ValueError:
raise Http404(_('Member does not exist'))
except Mailman404Error:
return render(request, template_name, {'nolists': 'true'})
initial_moderation = dict([
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment