I was just having a problem with this myself and this solution worked like a charm. Thank you! I'm still left with a question, though: How would you go about using sequence-item, etc. in a python expression? Python sees it as 'sequence minus item' and I get a 'Name Error: sequence' exception. I was wanting to do something like this: <table> <!--#in "dictionary.keys()"--> <tr> <td><!--#var sequence-item--></tr> <td><!--#var "records[sequence-item]"--></td> </tr> <!--#/in--> </table> Which seems natural to me but, of course, doesn't work. I have the feeling that I might need this in something like <!--#if "sequence-item=='gotcha!'"-->Ouch!<!--#/if--> someday. I've read the DTML manual several times but have I missed something here? <!--#with sequence-item-->??? Again, Thank You! John Jarvis Tokyo Electron FE, Ltd.
-----Original Message----- From: Amos Latteier [SMTP:Amos@digicool.com] Sent: Wednesday, March 31, 1999 3:56 AM To: 'ray@unival.com' Cc: 'zope@zope.org' Subject: [Zope] RE: DTML question
Sorry to bother you with these questions but I can't post to egroups. I tried senting messages on friday, saturday, monday and today but none went through. I've sent from the egroups post page, and from my email... no luck. Please feel free to cc the list with any answers or pointers to answers.
You can post to the list without egroups by sending mail to zope@zope.org. You can also read the archives without egroups at http://www.zope.org/pipermail/zope/.
I've been working throught the DTML manual and I've come across a problem; I can't get the #in tag to do what I want with a dictionary. I'm using it from Python for now, but plan to use this within a Zope app soon.
The following DTML code exits with this error: "...line 641, in renderwob l-len(sequence)"
<!--#in dictionary mapping --> <!--#var sequence-key --> <!--#var sequence-item --> <!--#/in -->
I think what you want is access to the dictionary's items() right?
<!--#in "dictionary.items()"--> <!--#var sequence-key--> : <!--#var sequence-item--> <!--#/in-->
The mapping attribute is not relevant here. It means treat sequence-items as mappings not instances, that is to say, look up vars with __getitem__, not __getattr__.
The DTML User's Guide is your friend.
-Amos
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
TFE MMS JARVIS JOHN