[Zope] converting Dictionary to Result
Alric Aneron
aluminum3458 at yahoo.com
Mon Jun 19 12:35:08 EDT 2006
Thanks,
Here is what I'm trying to do:
Let's say:
contents of myscript():
mydict = {'key1': 'value1', 'key2': 'value2'}
mydict2 = {'key1': 'value3', 'key2': 'value4'}
finalList = [mydict, mydict2]
return finalList
When I do this in a dtml-method:
<dtml-in "myscript()">
<dtml-var key1> <br/>
</dtml-in>
This will not return me this:
value1
value2
It gives me a key error.
However if I loop through a recordset, it produces proper output.
I'd like to merge a record object and a dictionary object so I can access them like I showed you here with dtml-in - so I can loop over both of them.
Is there a way?
Thanks in advance guys!
Andreas Jung <lists at zopyx.com> wrote:
--On 19. Juni 2006 09:16:23 -0700 Alric Aneron
wrote:
> Hello,
> I have a dictionary object and a result set object (that was returned
> from a ZSQL method). Is there any way I can merge them into one variable
> and use them in a dtml-in statement?
>
result sets have a dictionaries() method and dict have an update()
method..everything else is one-liner-Python magic and depends on your
usecase.
-aj
--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 T�bingen - Germany
Web: www.zopyx.com - Email: info at zopyx.com - Phone +49 - 7071 - 793376
E-Publishing, Python, Zope & Plone development, Consulting
---------------------------------
Yahoo! Sports Fantasy Football 06 - Go with the leader. Start your league today!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060619/25e15266/attachment.htm
More information about the Zope
mailing list