我正在尝试在 appengine 中使用带有 python 的 reportlab 生成 pdf。现在,每当我调用该函数以从 get(self) 函数生成 pdf 时,它都可以正常工作,但是当从 post(self) 调用该函数时,同样的事情不起作用。正如在日志中测试的那样,生成 pdf 的功能在这两种情况下都运行良好。问题似乎出在 pdf 输出中(获取和发布)。我曾尝试将内容处置保留为附件和内联,但无济于事。
这是 generatePdf 的部分代码:
class PDFHandler(BlogHandler):
def get(self):
self.render("create_offer_letter.html")
candidate_name = "Siddhant"
candidate_email ="ssjjs@ksks.com"
candidate_phone = "939393993"
address_part = ['sjsjjs','ksksksks']
confirmation_date = "22/07/2013"
coursefee = "282828"
admissionfee = "8388383"
institute ="NIMT"
course ="MBA"
feeterm ="Trimester"
#generatePdf(self,candidate_name,candidate_email,candidate_phone,address_part,confirmation_date,coursefee,admissionfee,institute,course, feeterm)
def post(self):
self.render("create_offer_letter.html")
candidate_name = "Siddhant"
candidate_email ="ssjjs@ksks.com"
candidate_phone = "939393993"
address_part = ['sjsjjs','ksksksks']
confirmation_date = "22/07/2013"
coursefee = "282828"
admissionfee = "8388383"
institute ="NIMT"
course ="MBA"
feeterm ="Trimester"
generatePdf(self,candidate_name,candidate_email,candidate_phone,address_part,confirmation_date,coursefee,admissionfee,institute,course, feeterm)
我想它必须与http头有关?不过我不确定。