Calling zsql from a page template
I'm missing some fairly basic syntax here, I'm sure, but the zsql chapter seems to only cover DTML. zsql_movienames is a zsql method returning simply a 'Name' column and requiring no arguments. I'm calling it thus: <table border="1" width="100%"> <tr> <th>Movie name</th> </tr> <tr tal:repeat="item zsql_movienames"> <td tal:content="item/Name">Some Movie Name</td> </tr> </table> But I'm getting Error Type: KeyError Error Value: zsql_movienames Any pointers to a doc that will cover what I'm trying to do? This is as elementary as it gets ... -roy
Roy S. Rapoport wrote:
[snip] zsql_movienames is a zsql method returning simply a 'Name' column and requiring no arguments. I'm calling it thus: [snip] <tr tal:repeat="item zsql_movienames"> [snip]
But I'm getting Error Type: KeyError Error Value: zsql_movienames
Any pointers to a doc that will cover what I'm trying to do? This is as elementary as it gets ...
The problem is simply that you must specify *where* the object will be found. Page templates know about the following starting points: root here container template request user modules In your case, you probably want to use either here/zsql_movienames or container/zsql_movienames as the path to your method, assuming it's in the same folder as your template. - Michael Bernstein
On Sat, Jul 19, 2003 at 10:39:28AM -0700, Michael Bernstein wrote:
In your case, you probably want to use either here/zsql_movienames or container/zsql_movienames as the path to your method, assuming it's in the same folder as your template.
Thanks, Michael! That works. -roy
Roy S. Rapoport wrote:
On Sat, Jul 19, 2003 at 10:39:28AM -0700, Michael Bernstein wrote:
In your case, you probably want to use either here/zsql_movienames or container/zsql_movienames as the path to your method, assuming it's in the same folder as your template.
Thanks, Michael! That works.
You're welcome. Might I suggest a copy of the Zope Bible (though the chapter on Page templates (chapter 18) is rather minimal): http://www.amazon.com/exec/obidos/ASIN/0764548573/fiawol Sincerely, - Michael Bernstein
participants (2)
-
Michael Bernstein -
Roy S. Rapoport