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. I got a really strange error though; Error Type: TypeError Error Value: unsupported operand type(s) for - Does this mean that I have an unsupported operand for the nothing after the dash or is it for the dash? There's no dash in the statement so I guess I have an unsupported operand for nothing :~{ P.S. Tim, sorry for sending this message twice. When I reply it goes directly to the source instead of the list and I forget to type the zope@zope.org before I send it. -----Original Message----- From: Tim Zegir [mailto:trzegir@ncable.net.au] Sent: Tuesday, December 02, 2003 6:48 PM To: joe@goldthwaites.com Subject: RE: [Zope] Two more questions Hi Joe, I had another look and realized I was doing the wrong thing ;) Try this instead. <tr tal:repeat="python:here.GetISLines(FY=request.FY;Per=request)"> From Tim Zegir -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 12:23 PM To: zope@zope.org Subject: RE: [Zope] Two more questions Thanks Tim, It didn't work. I get a SyntaxError on the question mark. Specifically; Compilation failed TAL.TALDefs.TALError: Python expression error: GetISLines?FY=request ^ SyntaxError: invalid syntax in expression 'python:GetISLines?FY=request', at line 10, column 5 This brings up more questions. I assume that GetISLines is looked up through acquisition. FY is the name of one of my parameters. How does it know that I want the FY attribute of the request object? Also, how would I pass two parameters? "GetISLines?FY=request;Per=request"? -----Original Message----- From: Tim Zegir [mailto:trzegir@ncable.net.au] Sent: Tuesday, December 02, 2003 5:46 PM To: joe@goldthwaites.com Subject: RE: [Zope] Two more questions Sorry about the last email :) In answer to the second question Try something like this: <tr tal:repeat="item python:GetISLines?FY=request">
From Tim Zegir
-----Original Message----- From: zope-bounces+trzegir=ncable.net.au@zope.org [mailto:zope-bounces+trzegir=ncable.net.au@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 11:36 AM To: zope@zope.org Subject: [Zope] Two more questions I really hate to keep bothering everyone but I'm still running into things I don't understand. In order to keep my table headers consistent across reports, I have them stored as a separate DTML method called IS_Ptd_Header. In my main Income Statement, I have this where I want the table header to show up; <span tal:replace="structure here/IS_Ptd_Header"></span> This works fine. The problem I've run into is when I want to use tal tags in the header like this; Income Statement for period <span tal:replace="request/Per">Period</span> If I have this line in the Income Statement, I get the Per parameter from the URL. The same line in IS_Ptd_Header gets ignored so the resulting page shows "Income Statement for period period". I thought that maybe the tal tags were being ignored because IS_Ptd_Header is a DTML method so I created a ZPT with the name IS_YTD_Header and used that in the tal replace command but the result came back as HTML quoted text instead of the actual HTML. Anyone know what I'm missing? Second problem. I have an external method called GetISLines. The actual function being called looks like this; def GetISLines(FY = 2, Per = 12, CatType = "Grp", Categories = ""): c = ISLines(FY, Per, CatType, Categories) return c.DefLines I've been doing all my testing using the default arguments with this tal tag; <tr tal:repeat="item here/GetISLines"> I need to pass in the URL parameters but I can't figure out how to do it. <tr tal:repeat="item here/GetISLines(request.FY)"> doesn't work. Nothing else I've tried works either. How do you pass parameters to an external function? Thanks. Joe Goldthwaite _______________________________________________ Zope maillist - Zope@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 ) _______________________________________________ Zope maillist - Zope@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 ) Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com.
Hi Joe, Change your external method def's to have Categories = something else than "". It could be that the ISLines function is creating the error because it does not like the zero length string.
From Tim Zegir
-----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 1:28 PM To: zope@zope.org Subject: RE: [Zope] Two more questions 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. I got a really strange error though; Error Type: TypeError Error Value: unsupported operand type(s) for - Does this mean that I have an unsupported operand for the nothing after the dash or is it for the dash? There's no dash in the statement so I guess I have an unsupported operand for nothing :~{ P.S. Tim, sorry for sending this message twice. When I reply it goes directly to the source instead of the list and I forget to type the zope@zope.org before I send it. -----Original Message----- From: Tim Zegir [mailto:trzegir@ncable.net.au] Sent: Tuesday, December 02, 2003 6:48 PM To: joe@goldthwaites.com Subject: RE: [Zope] Two more questions Hi Joe, I had another look and realized I was doing the wrong thing ;) Try this instead. <tr tal:repeat="python:here.GetISLines(FY=request.FY;Per=request)"> From Tim Zegir -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 12:23 PM To: zope@zope.org Subject: RE: [Zope] Two more questions Thanks Tim, It didn't work. I get a SyntaxError on the question mark. Specifically; Compilation failed TAL.TALDefs.TALError: Python expression error: GetISLines?FY=request ^ SyntaxError: invalid syntax in expression 'python:GetISLines?FY=request', at line 10, column 5 This brings up more questions. I assume that GetISLines is looked up through acquisition. FY is the name of one of my parameters. How does it know that I want the FY attribute of the request object? Also, how would I pass two parameters? "GetISLines?FY=request;Per=request"? -----Original Message----- From: Tim Zegir [mailto:trzegir@ncable.net.au] Sent: Tuesday, December 02, 2003 5:46 PM To: joe@goldthwaites.com Subject: RE: [Zope] Two more questions Sorry about the last email :) In answer to the second question Try something like this: <tr tal:repeat="item python:GetISLines?FY=request">
From Tim Zegir
-----Original Message----- From: zope-bounces+trzegir=ncable.net.au@zope.org [mailto:zope-bounces+trzegir=ncable.net.au@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 11:36 AM To: zope@zope.org Subject: [Zope] Two more questions I really hate to keep bothering everyone but I'm still running into things I don't understand. In order to keep my table headers consistent across reports, I have them stored as a separate DTML method called IS_Ptd_Header. In my main Income Statement, I have this where I want the table header to show up; <span tal:replace="structure here/IS_Ptd_Header"></span> This works fine. The problem I've run into is when I want to use tal tags in the header like this; Income Statement for period <span tal:replace="request/Per">Period</span> If I have this line in the Income Statement, I get the Per parameter from the URL. The same line in IS_Ptd_Header gets ignored so the resulting page shows "Income Statement for period period". I thought that maybe the tal tags were being ignored because IS_Ptd_Header is a DTML method so I created a ZPT with the name IS_YTD_Header and used that in the tal replace command but the result came back as HTML quoted text instead of the actual HTML. Anyone know what I'm missing? Second problem. I have an external method called GetISLines. The actual function being called looks like this; def GetISLines(FY = 2, Per = 12, CatType = "Grp", Categories = ""): c = ISLines(FY, Per, CatType, Categories) return c.DefLines I've been doing all my testing using the default arguments with this tal tag; <tr tal:repeat="item here/GetISLines"> I need to pass in the URL parameters but I can't figure out how to do it. <tr tal:repeat="item here/GetISLines(request.FY)"> doesn't work. Nothing else I've tried works either. How do you pass parameters to an external function? Thanks. Joe Goldthwaite _______________________________________________ Zope maillist - Zope@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 ) _______________________________________________ Zope maillist - Zope@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 ) Property of Bar-S Foods. This message is intended only for the use of the Addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended recipient, dissemination of this communication is prohibited. If you have received this communication in error, please erase all copies of the message and its attachments and notify us immediately at 602.264.7272 or postmaster@bar-s.com. _______________________________________________ Zope maillist - Zope@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 )
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. In addition, the request object is a mapping, not a collection of arbitrary attributes. Try request.get('FY') instead of request.FY.
I got a really strange error though;
Error Type: TypeError Error Value: unsupported operand type(s) for -
That IS odd. Are you sure that what you gave above is really your code? -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's CRO-STINKY DEMON MAN! (random hero from isometric.spaceninja.com)
Yep I'm sure. That's the line. I tried this also; <tr tal:repeat="item python:here.GetISLines(request.get('FY'), request.get('Per'), request.get('OrgType'), request.get('OrgNo'))"> I got the exact same message. I replaced the null parameter on the function but I still got the same result. I'll keep trying. Joe Goldthwaite -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Paul Winkler Sent: Tuesday, December 02, 2003 8:56 PM To: zope@zope.org Subject: Re: [Zope] Two more questions 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. In addition, the request object is a mapping, not a collection of arbitrary attributes. Try request.get('FY') instead of request.FY.
I got a really strange error though;
Error Type: TypeError Error Value: unsupported operand type(s) for -
That IS odd. Are you sure that what you gave above is really your code? -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's CRO-STINKY DEMON MAN! (random hero from isometric.spaceninja.com) _______________________________________________ Zope maillist - Zope@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 )
On Tue, Dec 02, 2003 at 09:02:19PM -0700, Goldthwaite, Joe wrote:
Yep I'm sure. That's the line. I tried this also;
<tr tal:repeat="item python:here.GetISLines(request.get('FY'), request.get('Per'), request.get('OrgType'), request.get('OrgNo'))">
I got the exact same message. I replaced the null parameter on the function but I still got the same result. I'll keep trying.
This suggests to me that the error is in your GetISLines code somewhere. We can't tell where unless you post a complete traceback. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's TOFU GIRL! (random hero from isometric.spaceninja.com)
Ok! I got it working. The problem appears was in my script. The default for FY was a number but request.FY was passing in a string. The code that was building my SQL statement was choking on it. I'm working again. Here's the line that worked; <tr tal:repeat="item python:here.GetISLines(FY=request.FY, Per=request.Per, OrgType=request.OrgType, OrgNo=request.OrgNo)"> Thanks again for your time Tim and Paul. -----Original Message----- From: zope-bounces+joe=goldthwaites.com@zope.org [mailto:zope-bounces+joe=goldthwaites.com@zope.org]On Behalf Of Paul Winkler Sent: Tuesday, December 02, 2003 9:58 PM To: zope@zope.org Subject: Re: [Zope] Two more questions On Tue, Dec 02, 2003 at 09:02:19PM -0700, Goldthwaite, Joe wrote:
Yep I'm sure. That's the line. I tried this also;
<tr tal:repeat="item python:here.GetISLines(request.get('FY'), request.get('Per'), request.get('OrgType'), request.get('OrgNo'))">
I got the exact same message. I replaced the null parameter on the function but I still got the same result. I'll keep trying.
This suggests to me that the error is in your GetISLines code somewhere. We can't tell where unless you post a complete traceback. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's TOFU GIRL! (random hero from isometric.spaceninja.com) _______________________________________________ Zope maillist - Zope@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 )
No probs, Always glad to help. From Tim Zegir -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of Goldthwaite, Joe Sent: Wednesday, 3 December 2003 4:32 PM To: zope@zope.org Subject: RE: [Zope] Two more questions Ok! I got it working. The problem appears was in my script. The default for FY was a number but request.FY was passing in a string. The code that was building my SQL statement was choking on it. I'm working again. Here's the line that worked; <tr tal:repeat="item python:here.GetISLines(FY=request.FY, Per=request.Per, OrgType=request.OrgType, OrgNo=request.OrgNo)"> Thanks again for your time Tim and Paul. -----Original Message----- From: zope-bounces+joe=goldthwaites.com@zope.org [mailto:zope-bounces+joe=goldthwaites.com@zope.org]On Behalf Of Paul Winkler Sent: Tuesday, December 02, 2003 9:58 PM To: zope@zope.org Subject: Re: [Zope] Two more questions On Tue, Dec 02, 2003 at 09:02:19PM -0700, Goldthwaite, Joe wrote:
Yep I'm sure. That's the line. I tried this also;
<tr tal:repeat="item python:here.GetISLines(request.get('FY'), request.get('Per'), request.get('OrgType'), request.get('OrgNo'))">
I got the exact same message. I replaced the null parameter on the function but I still got the same result. I'll keep trying.
This suggests to me that the error is in your GetISLines code somewhere. We can't tell where unless you post a complete traceback. -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's TOFU GIRL! (random hero from isometric.spaceninja.com) _______________________________________________ Zope maillist - Zope@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 ) _______________________________________________ Zope maillist - Zope@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 )
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)
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@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Paul Winkler Sent: Tuesday, December 02, 2003 9:49 PM To: zope@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@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 )
participants (4)
-
Goldthwaite, Joe -
Goldthwaite, Joe -
Paul Winkler -
Tim Zegir