- if not path.exists(pdf_file):
- result = async_build_pdf.delay(book.id, cust, pdf_file)
- result.wait()
- return AttachmentHttpResponse(file_name=("%s.pdf" % book.slug), file_path=pdf_file, mimetype="application/pdf")
+ url = WaitedFile.order(pdf_file,
+ lambda p: async_build_pdf.delay(book.id, cust, p),
+ book.pretty_title()
+ )
+ return redirect(url)