SOLVED: [ZPT] path variable doesn't exist

Justin Robertson nostrebornitsuj at hotmail.com
Wed Jan 21 03:52:19 EST 2004


What you've written would give you a syntax error I think! I trust you meant 
tal:condition and not tal:define. Anyway, and I think I said this before, it 
gives an Attribute error if cid or tid don't exist.

This does look somewhat verbose I agree, but essentially I've solved my 
problem, which was to deal with optional arguments in the querystring. The 
way to deal with them is just to put a block like this at the top of the 
page:

<div tal:define="global arg1 request/arg1 | nothing">
<div tal:define="global arg2 request/arg2 | nothing">
<div tal:define="global arg3 request/arg3 | nothing">
<div tal:define="global arg4 request/arg4 | nothing">

The you can do what you like with them lower down.


>From: Chris Withers <chris at simplistix.co.uk>
>To: Justin Robertson <nostrebornitsuj at hotmail.com>
>CC: robbenhaar at espresto.com,  zpt at zope.org
>Subject: Re: SOLVED: [ZPT] path variable doesn't exist
>Date: Wed, 21 Jan 2004 08:45:19 +0000
>
>Justin Robertson wrote:
>
>><div tal:define=cid request/cid | nothing>
>><div tal:define=tid request/tid | nothing>
>><div tal:condition="python:cid and tid">
>>  Only show me if cid and tid exist.
>></div>
>></div>
>
>The above seems overly verbose.
>What error do you get with:
><div tal:define="python:request.get('cid') or request.get('tid')">
>Only show me if cid and tid exist.
></div>
>
>cheers,
>
>Chris
>

_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger




More information about the ZPT mailing list