Zope tal/dtml syntax for results from external method...
I finally got my external method call working, and returning values... using <dtml-var getRecords> it prints: {u'item': [['1', 'Fido', '5.00'], ['2', 'Spot', '10.00'], ['4', 'Sparky', '24'], ['9', 'Buffy', '10'], ['10', 'Bobby', '50']]} the code for the above is: from SOAPpy import SOAPProxy def getAllRows(): server = SOAPProxy( "http:..." ) rows = server.getAll() return rows I can (in a python script) do: for row in rows: print row[0] ... I have been trying everything that I can think of to do the same in dtml, or preferably, tal... Could anyone post a snipit that would show how to get each element in a var and then access the positional element? Thanks in advance... JH jhood - hmcon com
This is a slightly contrived example that might help: <tal:dummy tal:repeat="a python:[list('phil'),list('harris'),list('bob')]"> <div tal:content="python:a[0]+a[1]+a[2]"/> </tal:dummy> hth On Wed, 25 Jun 2003 09:34:06 -0400, Jeffrey Hood <jhood@hmcon.com> wrote:
I finally got my external method call working, and returning values... using <dtml-var getRecords> it prints: {u'item': [['1', 'Fido', '5.00'], ['2', 'Spot', '10.00'], ['4', 'Sparky', '24'], ['9', 'Buffy', '10'], ['10', 'Bobby', '50']]}
the code for the above is: from SOAPpy import SOAPProxy
def getAllRows(): server = SOAPProxy( "http:..." ) rows = server.getAll() return rows
I can (in a python script) do: for row in rows: print row[0] ...
I have been trying everything that I can think of to do the same in dtml, or preferably, tal...
Could anyone post a snipit that would show how to get each element in a var and then access the positional element?
Thanks in advance...
JH
jhood - hmcon com
_______________________________________________ Zope maillist - Zope@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 )
-- Phil Harris
I typed in your example and nothing prints out... I must be missing something simple... JH
This is a slightly contrived example that might help:
<tal:dummy tal:repeat="a python:[list('phil'),list('harris'),list('bob')]"> <div tal:content="python:a[0]+a[1]+a[2]"/> </tal:dummy>
hth
On Wed, 25 Jun 2003 09:34:06 -0400, Jeffrey Hood <jhood@hmcon.com> wrote:
I finally got my external method call working, and returning values... using <dtml-var getRecords> it prints: {u'item': [['1', 'Fido', '5.00'], ['2', 'Spot', '10.00'], ['4', 'Sparky', '24'], ['9', 'Buffy', '10'], ['10', 'Bobby', '50']]}
the code for the above is: from SOAPpy import SOAPProxy
def getAllRows(): server = SOAPProxy( "http:..." ) rows = server.getAll() return rows
I can (in a python script) do: for row in rows: print row[0] ...
I have been trying everything that I can think of to do the same in dtml, or preferably, tal...
Could anyone post a snipit that would show how to get each element in a var and then access the positional element?
Thanks in advance...
JH
jhood - hmcon com
_______________________________________________ Zope maillist - Zope@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 )
participants (2)
-
Jeffrey Hood -
Phil Harris