Hi folks, I was trying page templates out for the first time the other day, and ran into this minor problem: After cut&pasting the code from the "compoundInterest" example in chapter 5 of TZB into my ZMI, they didn't work. The interestDisplay template, confronted with <span tal:replace="years">, threw an exception claiming that "years" was undefined. Changing it to <span tal:replace="request/years"> worked fine. Similarly, all references to request variables in the invocation of the Python script had to be changed from "variable" to "request.variable". Am I missing something here, or is this the way templates are supposed to work? (Incidentally, this was Zope 2.5.1 on a Linux box.) Thanks, -- Joe "I'd rather chew my leg off than maintain Java code, which sucks, 'cause I have a lot of Java code to maintain and the leg surgery is starting to get expensive." - Me
I believe this is fixed in the 2.6 edition of the Zope Book available at http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ Thanks for the report... ----- Original Message ----- From: "Joseph A. Knapka" <jknapka@earthlink.net> To: <zope@zope.org> Sent: Tuesday, August 27, 2002 1:14 PM Subject: [Zope] ZPT: examples in The Zope Book don't work
Hi folks,
I was trying page templates out for the first time the other day, and ran into this minor problem:
After cut&pasting the code from the "compoundInterest" example in chapter 5 of TZB into my ZMI, they didn't work. The interestDisplay template, confronted with <span tal:replace="years">, threw an exception claiming that "years" was undefined. Changing it to <span tal:replace="request/years"> worked fine. Similarly, all references to request variables in the invocation of the Python script had to be changed from "variable" to "request.variable".
Am I missing something here, or is this the way templates are supposed to work?
(Incidentally, this was Zope 2.5.1 on a Linux box.)
Thanks,
-- Joe "I'd rather chew my leg off than maintain Java code, which sucks, 'cause I have a lot of Java code to maintain and the leg surgery is starting to get expensive." - Me
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Chris McDonough wrote:
I believe this is fixed in the 2.6 edition of the Zope Book available at http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/
Thanks for the report...
Thanks for the reply :-) -- Joe "I'd rather chew my leg off than maintain Java code, which sucks, 'cause I have a lot of Java code to maintain and the leg surgery is starting to get expensive." - Me
Joseph A. Knapka writes:
After cut&pasting the code from the "compoundInterest" example in chapter 5 of TZB into my ZMI, they didn't work. The interestDisplay template, confronted with <span tal:replace="years">, threw an exception claiming that "years" was undefined. Changing it to <span tal:replace="request/years"> worked fine. Similarly, all references to request variables in the invocation of the Python script had to be changed from "variable" to "request.variable".
Am I missing something here, or is this the way templates are supposed to work? When "variable" is defined in "request", you need to access it with "request/variable". That's as it should be.
Make a comment in the commentable version of the Zope Book (2_6Edition), such that is gets fixed for the next release. Dieter
participants (3)
-
Chris McDonough -
Dieter Maurer -
Joseph A. Knapka