[Patchew-devel] [PATCH v2] rest: add api/v1/messages endpoint (POST support)
Fam Zheng
famz at redhat.com
Wed May 16 07:53:07 UTC 2018
On Wed, 05/16 09:38, Paolo Bonzini wrote:
> On 16/05/2018 03:31, Fam Zheng wrote:
> > On Tue, 05/15 14:08, Paolo Bonzini wrote:
> >> On 15/05/2018 14:02, Shubham Jain wrote:
> >>> + def create(self, request, *args, **kwargs):
> >>> + projects = [p for p in Project.objects.all() if p.recognizes(MboxMessage(self.request.data['mbox']))]
> >
> > It is better to create MboxMessage object once to avoid repeating the mbox
> > parse:
> >
> > m = MboxMessage(self.request.data['mbox'])
> > projects = [p for p in Project.objects.all() if p.recognizes(m)]
>
> Also the MboxMessage probably should be created from self.request.data,
> without doing more parsing of the mbox.
Not sure I understand this, is it related to your below idea? I don't see how
MboxMessage.__init__ should handle self.request.data.
>
> Alternatively, p.recognizes() could take an array of recipients rather
> than an MboxMessage.
Yes, but remember there is also the prefix_tags conditions.
Fam
More information about the Patchew-devel
mailing list