[ZPT] path variable doesn't exist

Chris Withers chris at simplistix.co.uk
Tue Jan 20 05:39:29 EST 2004


Justin Robertson wrote:

> What is the easy way to get round the error generated when a path 
> variable that doesn't exist is referred to? I'm trying to detect an 
> optional querystring argument, but when it's not there I get an error 
> for referring to it.
> 
> This is the code that generates the error when one or both of cid and 
> tid are not in the querystring.
> 
> <div tal:condition="python:request.cid and request.tid">
> Only show me if cid and tid exist.
> </div>

try:

python:request.get('cid') and request.get('tid')

but Celemens suggestions about using request.form.get are good...

cheers,

Chris




More information about the ZPT mailing list