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

Thomas G. Apostolou thomas.info at hol.gr
Mon Oct 17 05:40:39 EDT 2005


Αρχικό μήνυμα από  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.



> 
> > Now i want to get the funtion's results from within a
> > Page Template.
> 
> Which function? Give us an example of what you've tried...
> 
> > Is the right way to make a Script(Python) that calls
> > this module's function and then call this
> > Script(Python) from within my Page Template?
> 
> You should be able to make the call direct from the ZPT, but you'll
> have 
> to tell us what you're trying to do...
> 
> cheers,
> 
> Chris
> 
> -- 
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
> 
> _______________________________________________
> Zope maillist  -  Zope at 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 )
> 
> 


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


More information about the Zope mailing list