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

Thomas G. Apostolou thomas.info at hol.gr
Tue Oct 18 07:03:24 EDT 2005


Αρχικό μήνυμα από  Chris Withers <chris at simplistix.co.uk>:

> Thomas G. Apostolou wrote:
> >     <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>
> 
> What Tino said about using a database adapter is true, but even if
> you 
> want to stick with your external method, you can always use the 
> following ZPT:
> 
> <tr tal:repeat="data python:GetData(sysDSN=sysDSN,
>                                      usr=usr,
>                                      mypass=mypass,
>                                      sTable=sTable,
>                                      sFields=sFields)"
>     
> tal:attributes="python:test(path('repeat/data/odd'),'odd','even')"
>    <td tal:repeat="cell data"
>        tal:content="cell">
>    </td>
> </tr>
> 
> You only need to figure out where sysDSN, usr, mypass, sTable and 
> sFields come from. Your example being in DTML, I have no idea ;-)

sysDSN, usr, mypass are properties with values of a folder object witch
i use with aquisition to call the DTML Method trough it.
sTable and sFields are input fields of the form that calls the DTML
Method and submits its values


Thomas G. Apostolou
Software Engineer
Θωμάς Γ. Αποστόλου
Μηχανικός Λογισμικού


More information about the Zope mailing list