[Zope] Weird acquisition question

Terry Hancock hancock@anansispaceworks.com
Sat, 17 Aug 2002 11:05:33 -0700


Hi all,
I'm seeing a weird case of acquisition going on that
I don't really understand. From my point of view,
what I'm seeing is that a a high-level folder's properties
are overriding its children's.

This is an oversimplification, however, and I suspect
the problem is in the details:

This is occuring within a product. The product defines
two folderish-objects "Narya" and "Narya-Topic". Normally,
a tree of "Narya-Topic" objects exists below "Narya".
The "Narya-Topic" objects have a property called "banner",
which is also defined by "Narya" (ostensibly to provide
a default, even though that isn't what's happening).

Let's just consider one Narya object "Narya" with one
child Narya-Topic object "Tomobiki":

   Narya
     `- Tomobiki

Inside Tomobiki there are DTMLFile objects, which
include a DTMLFile method defined in Narya (called
"navbar").  The "forum_bannernavbar" object uses the
value of "banner" to determine its appearance.

Now if I set the Narya property "banner" to, say,
"ataru_jpg" and I set the Tomobiki property to,
say, "lum_jpg", navbar uses "ataru_jpg".

   Narya  (banner='ataru_jpg')
     `- Tomobiki (banner='lum_jpg')
             forum_bannernavbar  (banner == 'ataru_jpg')

If I then *delete* the property "banner" from Narya,
the navbar in Tomobiki now (correctly) shows "lum_jpg".

   Narya  (banner undefined)
     `- Tomobiki (banner='lum_jpg')
             forum_bannernavbar  (banner == 'lum_jpg') 

In other words, the property of Narya is shadowing the
property of its child Tomobiki.

Inserting reporting code into the DTMLFile objects, I
see that the DTMLFile objects inside (defined within)
Tomobiki have the value I expect ("lum_jpg"). The
problem occurs in calling forum_bannernavbar, which
then thinks banner="ataru_jpg" -- presumeably it is
putting its "container" ahead of its "context".

BTW, It doesn't appear to matter how I define the
Narya property -- I've defined it in the product
as well as eliminating it and adding it through the
ZMI. I get the same results either way.

Now, assuming this is the intended behavior, can anyone
explain why?   I have a suspicion I might be able to
solve this with a cleverly conceived dtml-with inside
forum_bannernavbar, but I don't know what to put in it.

Thanks!
Terry

(BTW, full source of Narya is in my CVS at SourceForge:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/spacelift/ 
this email addresses code in Narya.py, Topic.py, 
dtml/Narya/*.dtml, dtml/Topic/*.dtml).

-- 
------------------------------------------------------
Terry Hancock
hancock@anansispaceworks.com       
Anansi Spaceworks                 
http://www.anansispaceworks.com 
P.O. Box 60583                     
Pasadena, CA 91116-6583
------------------------------------------------------