hi, what's the way to know if an object has an attribute without acquisition? When I call getattr on a given object which has a parent with the desired attribute, it returns the parent attribute. Isn't there a way to give an additional argument to getattr which tell to use the acquisition mecanism ? -- Sylvain Thénault LOGILAB http://www.logilab.org
On Mon, Dec 16, 2002 at 06:36:32PM +0100, Sylvain Th?nault wrote:
hi,
what's the way to know if an object has an attribute without acquisition?
You can unwrap the object from its acquisition wrappers: getattr(foo.aq_base, "attribute") -- Paul Winkler http://www.slinkp.com "Welcome to Muppet Labs, where the future is made - today!"
On Monday 16 December à 09:44, Paul Winkler wrote:
On Mon, Dec 16, 2002 at 06:36:32PM +0100, Sylvain Th?nault wrote:
hi,
what's the way to know if an object has an attribute without acquisition?
You can unwrap the object from its acquisition wrappers:
getattr(foo.aq_base, "attribute")
and should it be accessible from a restricted python script (or whatever else like ZPT, DTML...) ? I've just tried and I got an "Attribute Error" -- Sylvain Thénault LOGILAB http://www.logilab.org
I use: getattr(foo.aq_explicit, "attribute") Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Sylvain Thénault Sent: Monday, December 16, 2002 12:56 PM To: Paul Winkler; Zope Mailing list Subject: Re: [Zope] getattr and acquisition On Monday 16 December à 09:44, Paul Winkler wrote:
On Mon, Dec 16, 2002 at 06:36:32PM +0100, Sylvain Th?nault wrote:
hi,
what's the way to know if an object has an attribute without acquisition?
You can unwrap the object from its acquisition wrappers:
getattr(foo.aq_base, "attribute")
and should it be accessible from a restricted python script (or whatever else like ZPT, DTML...) ? I've just tried and I got an "Attribute Error" -- Sylvain Thénault LOGILAB http://www.logilab.org _______________________________________________ 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 )
On Monday 16 December à 13:01, Kevin Carlson wrote:
I use:
getattr(foo.aq_explicit, "attribute")
it works fine in a restricted script. Thanks to you and Paul ! -- Sylvain Thénault LOGILAB http://www.logilab.org
participants (3)
-
Kevin Carlson -
Paul Winkler -
Sylvain Thénault