[Zope-CMF] DTML weirdness
Tom Bech
tom.bech@adcore.no
Wed, 15 Aug 2001 19:21:58 +0200
Ok, I give up. There's something here I don't grok...
I have a super-simple python script called 'get_news_list'
which looks like this:
---
objs = []
catalog = context.portal_catalog
for objref in catalog.searchResults(meta_type='News Item'):
objs.append(objref.getObject())
return objs
---
And I have this DTML method:
---
<dtml-let list="get_news_list()">
<dtml-var list html_quote><br><br>
<dtml-in list>
<dtml-let item=sequence-item>
<dtml-var "item.id"><br>
</dtml-let>
</dtml-in>
</dtml-let>
---
When I call the above DTML method I get this error message:
Error Type: AttributeError
Error Value: 'string' object has no attribute 'id'
If I change the DTML method to:
---
<dtml-let list="get_news_list()">
<dtml-var list html_quote><br><br>
<dtml-in list>
<dtml-var "id"><br>
</dtml-in>
</dtml-let>
---
I get the expected output:
[<NewsItem instance at 01C9AF38>, <NewsItem instance at 01B1FF98>]
test2
test1
Notice the html_quote'ed list shows the items as being NewsItem instances,
not strings. Why can't I access the newsitem via the obj variable in the
first DTML example?
Tom