On Fri, Jul 22, 2005 at 04:10:03PM +0100, Jon Bowlas wrote:
> And my get_attobject script contains the following code:
>       attobjects = context.objectValues('Attributes object')
>       if attobjects:
>             return attobjects[0]
>       return None
> But what I'd like to do in this situation is use acquisition to retrieve the
> values from the parent 'Attributes object' located in the site root. So
> could someone please explain how I could achieve this?

As you've discovered, objectValues() does not use acquisition, it
only looks for real sub-objects of the folder you call it on.
Same is true for objectItems() and objectIds().

This kind of thing is typically done by always using the same id for
your "attributes object". Then just acquire that id.
In a sense, the id becomes part of your API.

Your script would become:
attrobject = getattr(context, 'some_id', None)
return attrobject


Paul Winkler
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to