Luciano Ramalho wrote:
Thank you very much for the correction.
However, after checking your Wiki references, I must say I still don´t understand the difference between context and containment (these are words that I naively used as synonyms in my message).
In <http://www.zope.org/Wikis/zope-dev/AcquisitionUsage> we find:
""" - Containment: Search the object, then its container, then the container's container, and so on. Ignore objects not in this chain.
- Context: Search the objects in precisely the reverse of the order in which they were mentioned, so "A.B.C.D" is always searched in the order "D", "C", "B", "A".
"""
But for me, A.B.C.D means that A contains B; B contains C; and C contains D, so I don´t see the difference from the first definition.
Maybe you are using the word "container" in a more restricted sense?
This is how I see it: containment doesn't change, while context can, but is often the same as containment. So you create a method called "foo" and put it in /bar. "bar" is always that method's container. Then you create another folder called "boo" at the root. Then you access http://myserver/bar/foo . In this case, the context is the same as containment. But if you access http://myserver/bar/boo/foo , you're accessing foo in context of boo. The containment doesn't change--foo is still in bar. But the context is boo. Acquisition always searches the containers first, then the context. This may not appear to be inuitive, and it may seem sensible to search only the context, but actually that would break security--imagine being able to access someone else's folders in context of a user folder you own. In the case of http://myserver/bar/boo/foo, then, a name lookup searches boo, then the container of boo (the root folder). If the name hasn't been found yet, the lookup moves up in context to bar, then the container of bar (the root folder again). Does that clear it up? Shane