...I'm betting on the latter :)

The problem in a nutshell is that a dtml method seems to be returning itself
(that is, the dtml source of the method), rather than what it ought to be
returning. I have two classes, a "Topic" class, derived from ObjectMananger, and
a "Story" class. The Topics contain Stories. As you might imagine, I wanted a
method that would dig up the most recent stories in a Topic. So I wrote one and
put it in the the methods of the Topic class. Done with that, I wanted a method
that would decide which of the Stories from each topic to put on the main page.
But a weird thing happened. I got errors telling me that my function was
returing a string (I was trying to use it in a dtml-in tag). That's odd, I
thought, so changed the function to simply spit out the results of the method
call with a dtml-var tag. I discovered that it was spitting out the source of my
dtml method. Yikes! Aren't all variables supposed to be rendered?

Here's the method (named get_storys) in the Topic's methods:
<dtml-call "REQUEST.set('stories', [])">
<dtml-in "objectValues('Story')" reverse sort=Date>
    <dtml-if numStories>
        <dtml-if "sequence-index < (numStories - 1)">
            <dtml-call "stories.append(id)">
        <dtml-if "sequence-index == 0">
            <dtml-call "stories.append(id)">
<dtml-return stories>

Here's the method that calls that method:
<dtml-in "objectValues('Topic')">
    <dtml-with sequence-item>
        <dtml-var "get_storys">
<dtml-with "Economic.ColdFusion">
<dtml-var id>

In case you're wondering, I'm running zope 2.2.0.

Peter Hernberg
An all-purpose, antibacterial, lemon-scented geek/nerd

"If there were a nation of Gods,it would govern itself 
democratically. A government so perfect is not suited to 
--Jean-Jacques Rousseau

Do You Yahoo!?
Yahoo! Mail  Free email you can access from anywhere!

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to