[Zope] getattr and acquisition

Kevin Carlson khcarlso@bellsouth.net
Mon, 16 Dec 2002 13:01:21 -0500


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 )