[Zope] How to I use aquisition in an external method?
Jay, Dylan
djay@lucent.com
Mon, 24 Jan 2000 11:17:24 +1100
> -----Original Message-----
> From: Martijn Pieters [mailto:mj@digicool.com]
> Sent: Friday, January 21, 2000 8:09 PM
> To: Chris McDonough; Jay, Dylan
> Cc: 'zope@zope.org'
> Subject: RE: [Zope] How to I use aquisition in an external method?
>
>
> > -----Original Message-----
> > From: Chris McDonough [mailto:chrism@digicool.com]
> >
> > Dylan,
> >
> > I usually pass "this()" in to an external method to get a handle on
> > acquisition from an external method.
> >
> > e.g.:
> >
> > <dtml-call "emMyExternalMethod(this())">
> >
> > def myExternalMethod(context):
> > if context.folder.attribute:
> > do something
> > else:
> > do something else
> >
> > this() generally refers to the folder containing the dtml
> method. in
> > the external method, you can use acquisition through this object.
> >
> > "Jay, Dylan" wrote:
> > >
> > > I want to find out if a callable object exists from a
> > folder object using
> > > acquisition. ie if I call folder.method() it will be
> > guaranteed to work.
> > >
>
> If your external method signature has 'self' as the first
> parameter, the
> current object (be it the Folder or DTML Document or some
> such), will be
> passed in with that parameter.
>
> So:
>
> def MyExternalAttribute(self)
> return self.acquired_folder.attribute
I guess I didn't really make myself clear. I want to be able to tell whether
a method exists or not. Specifically a method of a certain name that can
exist somewhere in the aquisition path.