开发者

Python: KeyError with form.getfirst

开发者 https://www.devze.com 2023-01-07 00:14 出处:网络
I have a dtml page, which calls a function, with this code: <dtml-var public_blast(form.getfirst(\'job_ID\'))>

I have a dtml page, which calls a function, with this code:

<dtml-var public_blast(form.getfirst('job_ID'))>

But开发者_StackOverflow i get a key error? stating KeyError: "public_blast(form.getfirst('job_ID'))". I can see the job_ID variable at the top of the page. So i know it is being passed to the URL.

I cant see where im going wrong?


It's been a very long time since I did any DTML, but I don't think you can call Python functions directly like that inside a DTML tag.

Instead I think you need to use the expr attribute:

<dtml-var expr="public_blast(form.getfirst('job_ID'))">


Try <dtml-var "REQUEST['job_ID']">

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号