[Zope] Two more questions

Goldthwaite, Joe joe at goldthwaites.com
Wed Dec 3 00:00:02 EST 2003


Doh!  You caught me.  I was looking so hard at my GetISLines function I
missed my typo on the tal attribute.  It should read tal:repeat not
tal:replace.

I've been playing with it.  I think the error is coming from my script.  I
added a line "FY -=2000" and I got the same message but instead of the dash,
I got a "-=".  That tells me I'm calling my routine and it's giving the
error. I've been breaking things down into small steps.

<span tal:content="python:request.get('FY')"></span> prints the FY attribute
from the URL correctly but so does this;
<span tal:content="python:request.FY"></span>

This tells me I'm on the right track and that this is the correct syntax for
passing the URL attributes to my script.  I'll keep playing with it.

I've read through the page templates chapter a number of times. I've also
read the advanced section along with the appropriate sections in my other
three books but without specific examples on referencing the request
attributes from within the tal statement, I just couldn't figure it out.
It's not very intuitive for me having executable code in quotes.  It goes
against 20 years of habits and just throws my brain all out of whack.

Thanks again.

(I keep saying that but I really mean it!)


-----Original Message-----
From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
Paul Winkler
Sent: Tuesday, December 02, 2003 9:49 PM
To: zope at zope.org
Subject: Re: [Zope] Two more questions


On Tue, Dec 02, 2003 at 10:56:15PM -0500, Paul Winkler wrote:
> On Tue, Dec 02, 2003 at 07:27:42PM -0700, Goldthwaite, Joe wrote:
> > Thanks again.  Still no go although it looks like it's getting closer.
> > I tried this;
> >
> > <tr tal:replace="item python:here.GetISLines(FY=request.FY,
> > Per=request.Per)">
> >
> > To my programmer eyes, that looks like it might be correct.
>
> To mine it looks wrong :-)
> In fact, you should get a Compilation Failed error when you
> save that page template.  That's what I get here.

I neglected to mention why this is so.
There are two general forms of tal statements:
those that take only a TALES expression, and those
that take an identifier followed by whitespace followed
by an expression. tal:replace is one of the former,
so the "item" identifier is syntactically incorrect and
must be removed.

Identifiers are not allowed for tal:condition, tal:content,
tal:omit-tag, tal:on-error, tal:replace.

Identifiers are required for tal:attributes, tal:define, and
tal:repeat.

I was about to suggest that you need to read the Zope Book
introductory chapter on Page Templates. However, just
having re-read it for the first time in a long time,
I don't think it's very newbie-friendly at all.
Maybe you read it already :-\
It skips too quickly through the basics, doesn't really
explain some basic concepts, and gets you into
writing python scripts too early, a topic which is covered
more appropriately in later chapters.

--

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's BUSTY HYDRO WIZARD!
(random hero from isometric.spaceninja.com)

_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )




More information about the Zope mailing list