SOLVED: [ZPT] path variable doesn't exist
Justin Robertson
nostrebornitsuj at hotmail.com
Sun Jan 25 12:49:02 EST 2004
Yes that's a very sensible idea.
>From: Casey Duncan <casey at zope.com>
>To: "Justin Robertson" <nostrebornitsuj at hotmail.com>
>CC: zpt at zope.org
>Subject: Re: SOLVED: [ZPT] path variable doesn't exist
>Date: Wed, 21 Jan 2004 09:22:26 -0500
>
>On Wed, 21 Jan 2004 08:52:19 +0000
>"Justin Robertson" <nostrebornitsuj at hotmail.com> wrote:
>
> > 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.
>
>FYI: You can define multiple values in a single tal:define:
>
> <div tal:define="x request/foo|nothing;
> y request/bar|nothing;
> z python:x or y or 'baz'">
>
>I would suggest that when you find yourself doing this, however, that
>you should seriously think about creating a python script that creates a
>datastructure (like a
>list or dict) that is already preformatted and setup so that the page
>template can just do the presentation.
>
>-Casey
_________________________________________________________________
Express yourself with cool emoticons - download MSN Messenger today!
http://www.msn.co.uk/messenger
More information about the ZPT
mailing list