Python: KeyError with form.getfirst
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']">
精彩评论