[Zope] use of objectValues() in DTML Methods vs. DTML Documents

Chris Withers chrisw@nipltd.com
Wed, 25 Oct 2000 16:35:22 +0100


Mike Bannister wrote:
> Just for the heck of it I dropped that same code into a DTML Document in the
> same Folder and it didn't list the Files as I had expected. I understand
> pretty much the differences of Methods and Documents and I'm assuming the
> reason for this is related to the way the Documents exists in it's own
> namespace and the Method doesn't... so my best guess for this behavior is
> that the 'scope' of objectValues() is limited to the current namespace.
> 
> Am I even close? If not can someone explain this to me?

This is quite a thorny FAQ. The root of it is the binding of methods to
objects/namespaces in DTML, which has had lots of press on
zope-dev@zope.org recently.

The short version is:

-if that code is in a method, it is executed on the method's container
(actualyl acquisition context, but don't worry abotu that too much ;-)
-if the code was in a documents, it is executed on that document. Since
documents can't really have things attached to them that would be
returned by objectValues, you usually get an empty list back :-)

HTH,

Chris