[Zope] Getting information about current method

Florent Guillaume fg at nuxeo.com
Mon Jun 20 11:58:39 EDT 2005


Peter Bengtsson  <peter at fry-it.com> wrote:
> On 6/17/05, Jan-Ole Esleben <esleben at gmail.com> wrote:
> > It's an application instance wrapped in a list; it seems to be
> > identical to self, actually - self.REQUEST['URL'] and
> > self.REQUEST.PARENTS[0].REQUEST['URL'] are the same. However, the two
> > REQUESTs are not the identical object (== returns False).
> > 
> 
> Then I don't know. 
> (The application instance is none other than zope itself. )
> I can honestly not think of a way to extract this information. I've
> even tried setting up a simple example method and I couldn't get hold
> of the zodb name of the external method that is called.

You can go the low-level route: Using the inspect module, you can get to
the stack frames of your callers, and then inspect the local variables
there. There must be one that can get you the information you want.

See the docstrings of the functions in the inspect module for details.

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope mailing list