[Zope3-Users] Re: Calling SQL Script in a ZPT

Philipp von Weitershausen philipp at weitershausen.de
Fri Apr 22 06:35:40 EDT 2005


Nicolas Legault wrote:
> So far I've succesfully execute an SQL script from a ZPT page with this
> code:
> 
>   <tal:div  tal:repeat="row container/sql_script">
>     <h1 tal:content="string: ${row/column_one}, ${row/column_two}" />
>   </tal:div>
> 
> Now I wan't to pass some arguments to the SQL script.
> 
> I've tried this example in ZPT found on
> http://www.plope.com/Books/2_7Edition/RelationalDatabases.stx#1-8 i know
> it's a zope 2.7 example...
> 
>   <tal:div  tal:repeat="row python: here.sql_script(limit=10)">
>     ...
>   </tal:div>
> 
> I've got an error : "here" is not defined.

Yes. 'here' is a Zope2ism. Use 'context' or 'container' instead.

> I've tried with "container", "context"... always got an error.

What error?

> Can someone tell me how to pass arguments to the SQL Script objects ?

Same as with Zope2-style SQLMethods: as keyword arguments. The above 
example should work, provided your SQL is sane and you have a working 
database adapter.

> Is there a documentation on this topic for X3 ?

Not really because Zope 3's focus is not through-the-web (TTW) 
development. The main method of developing Zope 3 components is regular 
file system development.

If you're looking for general documentation on Zope 3, there are two 
books available: http://worldcookery.com and 
http://dev.zope.org/Zope3/Zope3Book.

Regards,

Philipp



More information about the Zope3-users mailing list