[Zope] Re: object acquisition via python scripts

Malcolm Cleaton malcolm at jamkit.com
Fri Jul 22 11:22:50 EDT 2005


On Fri, 22 Jul 2005 16:10:03 +0100, Jon Bowlas wrote:
>       attobjects = context.objectValues('Attributes object')
... 
> 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?

Looking up your attributes object through objectValues will prevent
acquisition - rather than just asking the object to find an attributes
object for you, you're asking it for any attributes object amongst its
children only.

To search for your attributes object with acquisition, you could do:

getattr(context, 'Attributes object')

If the id of your attributes object did not contain a space (or anything
else illegal in a python identifier), for example AttributesObject, you
could just do:

context.AttributesObject

Thanks,
Malcolm.

-- 

    [] j a m k i t
      web solutions for charities

         malcolm cleaton
T:  020 7549 0520
F:  020 7490 1152
M:  07986 563852
W: www.jamkit.com




More information about the Zope mailing list