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

2000-10-25 Thread Ron Bickers

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mike
> Bannister
> Sent: Wednesday, October 25, 2000 5:44 AM
> To: [EMAIL PROTECTED]
> Subject: [Zope] use of objectValues() in DTML Methods vs. DTML Documents

> 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?

That's basically it, yes.

I think of a method as being a function that works on the object it is "in",
and a document as being an object that gets worked on.  So objectValues() in
a method will return objects from its container, whereas objectValues() in a
document will always return objects from within that document.

Acquisition plays a role too, since a method can work in different contexts.

For example (given myMethod and myDocument that both use objectValues())

TestFolder1.myMethod will return objects in TestFolder1
TestFolder2.myMethod will return objects in TestFolder2

TestFolder1.myDocument will return objects in myDocument
TestFolder2.myDocument will return objects in myDocument

I hope this makes sense.

___

Ron Bickers
Logic Etc, Inc.
[EMAIL PROTECTED]



___
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] use of objectValues() in DTML Methods vs. DTML Documents

2000-10-25 Thread Chris Withers

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

___
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 )