<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>You could try something like:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>contents of myscript():<BR>mydict = {'key1':
'value1', 'key2': 'value2'}<BR>mydict2 = {'key1': 'value3', 'key2':
'value4'}<BR></FONT><FONT><FONT face=Arial size=2></FONT></FONT></DIV>
<DIV><FONT><FONT face=Arial size=2>rList = []</FONT></FONT></DIV>
<DIV><FONT><FONT face=Arial size=2>for item in mydict.keys():<BR>
rList.append( (item, mydict1[item]) )<BR>for item in
mydict2.keys():<BR> rList.append( (item, mydict2[item]) )<BR>return
rList<BR></DIV></FONT></FONT>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>then, in your DTML method:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><dtml-in myscript><BR> <dtml-var
sequence-key>, <dtml-var
sequence-item><br><BR> </dtml-in>
<BR></FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Jonathan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> </DIV></FONT>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=aluminum3458@yahoo.com href="mailto:aluminum3458@yahoo.com">Alric
Aneron</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=lists@zopyx.com
href="mailto:lists@zopyx.com">Andreas Jung</A> ; <A title=zope@zope.org
href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, June 19, 2006 12:35
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Zope] converting Dictionary
to Result</DIV>
<DIV><FONT face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><FONT face=Arial size=2></FONT><BR></DIV>Thanks,<BR>Here is what
I'm trying to do:<BR>Let's say:<BR>contents of myscript():<BR>mydict =
{'key1': 'value1', 'key2': 'value2'}<BR>mydict2 = {'key1': 'value3', 'key2':
'value4'}<BR>finalList = [mydict, mydict2]<BR>return finalList<BR><BR>When I
do this in a dtml-method:<BR><dtml-in "myscript()"><BR>
<dtml-var key1> <br/><BR></dtml-in><BR>This will not return
me this:<BR>value1<BR>value2<BR>It gives me a key error.<BR>However if I loop
through a recordset, it produces proper output.<BR>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.<BR><BR>Is there a
way?<BR><BR>Thanks in advance guys!<BR><BR><B><I>Andreas Jung
<lists@zopyx.com></I></B> wrote:
<BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR><BR>--On
19. Juni 2006 09:16:23 -0700 Alric Aneron
<ALUMINUM3458@YAHOO.COM><BR>wrote:<BR><BR>> Hello,<BR>> I have a
dictionary object and a result set object (that was returned<BR>> from a
ZSQL method). Is there any way I can merge them into one variable<BR>>
and use them in a dtml-in statement?<BR>><BR><BR>result sets have a
dictionaries() method and dict have an update() <BR>method..everything else
is one-liner-Python magic and depends on your
<BR>usecase.<BR><BR>-aj<BR><BR><BR>-- <BR>ZOPYX Ltd. & Co. KG -
Charlottenstr. 37/1 - 72070 T�bingen - Germany<BR>Web: www.zopyx.com -
Email: info@zopyx.com - Phone +49 - 7071 - 793376<BR>E-Publishing, Python,
Zope & Plone development,
Consulting<BR></ALUMINUM3458@YAHOO.COM></BLOCKQUOTE><BR>
<P>
<HR SIZE=1>
Yahoo! Sports Fantasy Football ’06 - Go with the leader. <A
href="http://us.rd.yahoo.com/evt=33539/*http://football.fantasysports.yahoo.com?ovchn=YAH&ovcpn=Integration&ovcrn=Mail+footer&ovrfd=YAH&ovtac=AD">Start
your league today!</A>
<P>
<HR>
<P></P>_______________________________________________<BR>Zope maillist
-
Zope@zope.org<BR>http://mail.zope.org/mailman/listinfo/zope<BR>**
No cross posts or HTML encoding! **<BR>(Related lists -
<BR> http://mail.zope.org/mailman/listinfo/zope-announce<BR> http://mail.zope.org/mailman/listinfo/zope-dev
)<BR></BLOCKQUOTE></BODY></HTML>