Zope Sequences and Python Scripting
Patrick W. Fraley
patrick at fraley.de
Thu Apr 17 08:34:16 EDT 2003
Hi,
first off: I am pretty new to python and have just started with Zope, so
please excuse and fopars on my side :)
I have a python script which returns a [] containing {}. Now I can go
thru the returned array (I know this is perl lingo, sorry that is my
background) by using the <dtml-in> method, but I can not
access the values of the dictionary contained within the sequence item.
And here is what I am trying to do with the returned array:
<dtml-in filter_row>
<dtml-var filter_id><br>
<dtml-var bez_ref><br>
<dtml-var col_span><br>
<hr>
</dtml-in>
Here is the python script (filter_row):
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE
colspan = 1
curFilterId = -1
curFilter = {}
seqFilters = []
for spalte in context.get_spalten_liste(tabellen_id=request.tabellen_id):
if curFilterId != spalte.filter_id:
if len(curFilter)>0:
if curFilterId>0:
curFilterData = context.get_filter(filter_id=curFilterId)
curFilter['bez_ref'] = curFilterData[0].bez_ref
curFilter['filter_id'] = curFilterId
seqFilters.append(curFilter)
else:
curFilter['filter_id'] = curFilterId
curFilter['bez_ref'] = " "
seqFilters.append(curFilter)
curFilterId = spalte.filter_id
curFilter = {}
curFilter['col_span'] = 1
else:
curFilter['col_span'] = curFilter['col_span'] + 1
if len(curFilter)>0:
if curFilterId>0:
curFilterData = context.get_filter(filter_id=curFilterId)
curFilter['bez_ref'] = curFilterData[0].bez_ref
curFilter['filter_id'] = curFilterId
seqFilters.append(curFilter)
else:
curFilter['bez_ref'] = " "
seqFilters.append(curFilter)
return seqFilters
More information about the Python-list
mailing list