[Zope] dictionary from sequence-item

Alric Aneron aluminum3458 at yahoo.com
Mon Jun 19 14:46:39 EDT 2006


Hello,
I am looping through a list of dictionary objects using <dtml-in...
and within the dtml-in body I have:
<dtml-var "_.getitem('sequence-item')['titled']" missing="none">
Some of the dictionaries in the list don't have 'titled' key so it should replace it with the word "none", but it gives me an error
Error Type: KeyError
       Error Value: 'titled'
 I don't understand.  Another option is that I can use <dtml-if "_.getitem('sequence-item').has_key('titled')"> but it doesn't work, says has_key is an unknown attribute.  This is the stupidest thing ever! it's a dictionary object!
I try to typecast it using the dict(_.getitem('sequence-item')).has_key('titled') it gives me an error saying it can't typecast, but I am 100% sure it's a dictionary object because I can access it easily _.getitem('sequence-item')['titled'] for those that have that key.

Any idea how I can check if the titled key is in the dictionary for the current list item?

Thanks in advance guys!

		
---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060619/05761f0d/attachment.htm


More information about the Zope mailing list