diff --git a/ietf/community/tests.py b/ietf/community/tests.py index 387877887f..bdcd09d041 100644 --- a/ietf/community/tests.py +++ b/ietf/community/tests.py @@ -92,9 +92,8 @@ def test_view_list_duplicates(self): url = urlreverse(ietf.community.views.view_list, kwargs={ "email_or_name": person.plain_name()}) r = self.client.get(url) - self.assertEqual(r.status_code, 300) - self.assertIn("bazquux@example.com", r.content.decode()) - self.assertIn("foobar@example.com", r.content.decode()) + self.assertEqual(r.status_code, 404) + def complex_person(self, *args, **kwargs): person = PersonFactory(*args, **kwargs) diff --git a/ietf/community/views.py b/ietf/community/views.py index a9d3bd5845..f1f0d032b6 100644 --- a/ietf/community/views.py +++ b/ietf/community/views.py @@ -43,7 +43,7 @@ def lookup_community_list(request, email_or_name=None, acronym=None): if hasattr(request.user, 'person') and request.user.person in persons: person = request.user.person else: - raise MultiplePersonError("\r\n".join([p.user.username for p in persons])) + raise MultiplePersonError("Found multiple persons") else: person = persons[0] clist = CommunityList.objects.filter(person=person).first() or CommunityList(person=person) @@ -53,8 +53,8 @@ def lookup_community_list(request, email_or_name=None, acronym=None): def view_list(request, email_or_name=None): try: clist = lookup_community_list(request, email_or_name) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 docs = docs_tracked_by_community_list(clist) docs, meta = prepare_document_table(request, docs, request.GET) @@ -75,8 +75,8 @@ def manage_list(request, email_or_name=None, acronym=None): # database so we can't call related stuff on it yet try: clist = lookup_community_list(request, email_or_name, acronym) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 if not can_manage_community_list(request.user, clist): permission_denied(request, "You do not have permission to access this view") @@ -165,8 +165,8 @@ def track_document(request, name, email_or_name=None, acronym=None): if request.method == "POST": try: clist = lookup_community_list(request, email_or_name, acronym) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 if not can_manage_community_list(request.user, clist): permission_denied(request, "You do not have permission to access this view") @@ -190,8 +190,8 @@ def untrack_document(request, name, email_or_name=None, acronym=None): doc = get_object_or_404(Document, name=name) try: clist = lookup_community_list(request, email_or_name, acronym) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 if not can_manage_community_list(request.user, clist): permission_denied(request, "You do not have permission to access this view") @@ -212,8 +212,8 @@ def untrack_document(request, name, email_or_name=None, acronym=None): def export_to_csv(request, email_or_name=None, acronym=None): try: clist = lookup_community_list(request, email_or_name, acronym) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 response = HttpResponse(content_type='text/csv') @@ -256,8 +256,8 @@ def export_to_csv(request, email_or_name=None, acronym=None): def feed(request, email_or_name=None, acronym=None): try: clist = lookup_community_list(request, email_or_name, acronym) - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 significant = request.GET.get('significant', '') == '1' @@ -297,8 +297,8 @@ def subscription(request, email_or_name=None, acronym=None): clist = lookup_community_list(request, email_or_name, acronym) if clist.pk is None: raise Http404 - except MultiplePersonError as err: - return HttpResponse(str(err), status=300) + except MultiplePersonError: + raise Http404 person = request.user.person