[Zope] How can i call a pyhton module's function from with in Page Temmplates?

Tino Wildenhain tino at wildenhain.de
Mon Oct 17 06:20:14 EDT 2005


Thomas G. Apostolou schrieb:
> Αρχικό μήνυμα από  Chris Withers <chris at simplistix.co.uk>:
> 
> 
>>Thomas Apostolou wrote:
>>
>>>i saw that from within a DTML Method one is able to
>>>call a fuction of a python module in the file system.
>>
>>I don't think so...
> 
> 
> Well, you are right. I do not directly call the modules's function from
> the file system.
> I call an External Method that "wraps" the module's function and then i
> call that External Method from my DTML Method. Here is the example:
> 
>     <dtml-in expr="GetData(sysDSN=sysDSN, usr=usr, mypass=mypass,
> sTable=sTable, sFields=sFields)">
>       <dtml-if sequence-even>
>         <tr class="even">
>       <dtml-else>
>         <tr class="odd">
>       </dtml-if>
>       <dtml-in sequence-item>
>         <td><dtml-var sequence-item> </td>
>       </dtml-in>
>       </tr>
>     </dtml-in>
> 
> 
> GetData is the name of the External Method i call with the parameters of
> the module's function as you can see.
> 

Dont do that. Use a Database adaptor instead - any maybe issue
the query there if you dont want the ZSQL-Resultset-wrapping.
The reason is, ZDAs take care of pooling and so on and you avoid
a per thread reconnection.



More information about the Zope mailing list