From: Fam Zheng <fam@euphon.net>
Returning Http404 for real request is intended, but we also get called
from schema generators which doesn't pass any projects_pk. So only
reject if a key is provided.
---
api/rest.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/api/rest.py b/api/rest.py
index 3a9def5..2e9297a 100644
--- a/api/rest.py
+++ b/api/rest.py
@@ -406,8 +406,8 @@ class ProjectMessagesViewSetMixin(mixins.RetrieveModelMixin, mixins.UpdateModelM
return self.__project
def get_serializer_context(self):
- if self.project is None:
- raise Http404
+ if "projects_pk" in self.kwargs and not self.project:
+ raise Http404("Project not found")
context = super(ProjectMessagesViewSetMixin, self).get_serializer_context()
context["project"] = self.project
return context
--
2.25.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel