def dispatch(self, request, *args, **kwargs):
if '<STR_LIT>' in self.kwargs:<EOL><INDENT>try:<EOL><INDENT>self.invoices = Invoice.objects.filter(pk=self.kwargs.get('<STR_LIT>'))[:]<EOL><DEDENT>except ValueError:<EOL><INDENT>raise Http404()<EOL><DEDENT>if not self.invoices:<EOL><INDENT>raise Http404()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ids = request.GET.get('<STR_LIT>', '<STR_LIT>')<EOL>try:<EOL><INDENT>self.invoices = Invoice.objects.filter(id__in=[x for x in ids.split('<STR_LIT:U+002C>')])[:]<EOL><DEDENT>except ValueError:<EOL><INDENT>return HttpResponseBadRequest(_('<STR_LIT>'))<EOL><DEDENT><DEDENT>if not self.invoices:<EOL><INDENT>return HttpResponseBadRequest(_('<STR_LIT>'))<EOL><DEDENT>toNotify = []<EOL>cannotNotify = []<EOL>for invoice in self.invoices:<EOL><INDENT>if invoice.get_default_recipients():<EOL><INDENT>toNotify.append(invoice)<EOL><DEDENT>else:<EOL><INDENT>cannotNotify.append(invoice)<EOL><DEDENT><DEDENT>self.toNotify = toNotify<EOL>self.cannotNotify = cannotNotify<EOL>return super(InvoiceNotificationView, self).dispatch(request, *args, **kwargs)<EOL>
Get the set of invoices for which to permit notifications