AW: [Zope-CMF] How to LOOK THROUGH acquisition?
Eugene
el-spam at yandex.ru
Wed Sep 1 09:02:36 EDT 2004
Hello, Dan.
You wrote:
> Hi,
>>> How can I look througt acquisition process?
> Sounds like you don't actually want the acquisition machinery to happen! :)
> How about something like this (pseudo-code!)
> s = getSiteRoot()
> c = context
> tracked_attrs = {}
> while c != s:
> v = getattr(aq_base(c), attr, None)
> if not v is None:
> tracked_attrs[c] = v # if you need v wrapped, then just
> # use getattr rather than v
> c = c.aq_parent
> return tracked_attrs
> That'll give you a dict keyed on the objects which have the attribute attr
> you're looking for. If order is important to you (ie. where the object
> with that attribute is in the acquisition path) then don't use a dict, or
> key it on something else - use your imagination :)
Thank you for the solution!
--
Cheers,
Eugene mailto:el-spam at yandex.ru
More information about the Zope-CMF
mailing list