[Zope] A strange difference between DTMLDocument versus DTMLMethod Zope 2.2.2

Ron Bickers rbickers@logicetc.com
Wed, 20 Sep 2000 16:37:31 -0400


The is a good example for illustrating the difference in a DTML Method and a
DTML Document.

With the below code, when "objectItems('Folder')" is called in a DTML
Method, the list returned is a list of Folders in the DTML Method's
*container* object (often a Folder).  In this case, you'll get a list of the
Folders that are in the Folder where the DTML Method is.

When "objectItems('Folder')" is called in a DTML Document, the DTML Document
itself is the object where Folder items are being searched for.  Since there
cannot be Folder items in a DTML Document, you get an empty list.

When you call "PARENTS[-1].objectItems('Folder')", you're asking for the
Folder items in the root object (PARENTS[-1]), so you get a list of Folders
in the root Folder.

The only time you'll get a non-empty result is when you call
objectItems('Folder') from an object that can contain other Folders.  A
Folder object, of course, is the most common object that can contain
Folders.

In short, the behavior you are experiencing is correct and by design.

_______________________

Ron Bickers
Logic Etc, Inc.
rbickers@logicetc.com


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> cuiod-tec Jens Gelhaar
> Sent: Wednesday, September 20, 2000 11:40 AM
> To: zope@zope.org
> Subject: [Zope] A strange difference between DTMLDocument versus
> DTMLMethod Zope 2.2.2
>
>
> The following few lines have a different result, when I execute
> it within an
> DTMLDocument or DTMLMethod.
>
> <dtml-var standard_html_header>
> <dtml-in "objectItems('Folder')">
>   <dtml-var title_or_id>
> </dtml-in>
> <dtml-var standard_html_footer>
>
> The DTMLMethod result looks like it should be, but within a
> DTMLDocument the
> result is empty. When I modify the <dtml-in> tag slightly, then
> it works to
>
> <dtml-in "PARENTS[-1].objectItems('Folder')">
>
> I does not seem to me consistent. Is it a new feature or bug.
> Beside, when I
> call the DTMLMethod from another Document, the result is empty to.