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

2000-09-20 Thread Ron Bickers


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.
[EMAIL PROTECTED]


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
 cuiod-tec Jens Gelhaar
 Sent: Wednesday, September 20, 2000 11:40 AM
 To: [EMAIL PROTECTED]
 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.


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




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

2000-09-20 Thread Dieter Maurer

cuiod-tec Jens Gelhaar writes:
  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
That is (almost) as it is supposed to be.

  In both cases, "objectItems" is looked up in the so called
  DTML namespace.

  If your object is a DTML document, then the (relevant) top level
  element is the document itself. If it is a DTML method,
  the method itself is not placed on the namespace, only
  its "client", i.e. the object for with the method has been
  called (usually, but not necessary a folder).

The only maybe a bit surprising thing is that a DTML document
seems to have an "objectItems" method which, of cause,
returns the empty sequence.

If you use "PARENTS[0]", then you get a similar result
to that, you would have with a DTML method.


Dieter

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