Return data from python
I am new to Zope and Python. I want to be able to return the results of calculations from a python script. The script gathers 3 bits of information from a database using 3 queries. I want to add up the 3 numbers and return to the calling DTML the 4 numbers. What is the best way to do this. Also as a side note... These numbers are dollar amounts. I have not found a way to format them in Python. Can you offer any suggestions. Thanks Gene
Tuttle, Gene wrote:
I am new to Zope and Python.
I want to be able to return the results of calculations from a python script. The script gathers 3 bits of information from a database using 3 queries. I want to add up the 3 numbers and return to the calling DTML the 4 numbers. What is the best way to do this.
return a list or dict from python. A dict is better if you use page templates instead of DTML. <dtml-let result="your_script(parameters)" first="result[0]" ...> <dtml-var first> </dtml-let>
Also as a side note... These numbers are dollar amounts. I have not found a way to format them in Python. Can you offer any suggestions.
Use the fmt attribute. Take a look at http://zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixA.stx search for fmt HTH -- //// (@ @) ----------------------------oOO----(_)----OOo-------------------------- <> Ojo por ojo y el mundo acabara ciego /\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain) -----------------------------------------------------------------------
participants (2)
-
Alexis Roda -
Tuttle, Gene