[Zope] Finding acquired properties in an external method

sean.upton@uniontrib.com sean.upton@uniontrib.com
Sun, 25 Nov 2001 20:55:31 -0800


Hopefully I understand the problem here...  Correct me if I am wrong.

Part of the problem with acquisition is that if propertyItems() exists
within person's namespace it will only render within that, meaning that
unless propertyItems() itself harvests properties from other areas above
person in the acquisition stack, acquisition won't help here.  

What I have done in the past is create, recursively, flat property
registries returning dictionaries, with underlying logic using
getPhysicalPath() and restrictedTraverse(); one method recursively builds a
stack of the hierarchy using getPhyicalPath and custom logic to determine
where to stop in the hierarchy, turns the stack into a queue, and then
returns it; another method then walks that path (as a queue) to get all
properties in the path, provided there are no name collisions for those
properties, and returns them all as a big dictionary...  I haven't done this
with properties, but data stored in several ParsedXML docs, but the same
idea should apply.  Not entirely graceful (or as magic as acquisition), but
it works.

Sean

-----Original Message-----
From: Bruce Eckel [mailto:Bruce@EckelObjects.com]
Sent: Sunday, November 25, 2001 8:29 PM
To: zope@zope.org
Cc: chrism@digicool.com
Subject: [Zope] Finding acquired properties in an external method


If you say:
person.propertyItems()
In an external method, you get ONLY the properties of person, not
any properties that person "inherits" by acquisition.

How do you access the "inherited" properties? Thanks.

Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" & "Thinking
in C++ 2e"
Please subscribe to my free newsletter -- just send any email to:
join-eckel-oo-programming@earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================



_______________________________________________
Zope maillist  -  Zope@zope.org
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 )