Garito wrote:
Can I know the execution contexto of an object?

I would like to know if the object is call by ZMI or DTML or Page Templates etc

is it posible?

Perhaps; I am not sure I can see why it would be *desirable*. Given that Scripts, DTMLMethods, etc., try pretty hard to push themselves onto the execution stack just as though they were methods, you could probably introspect the result of calling 'sys._getframe(1)' to figure out what kind of thing called you.


From the Python Cookbook, #14.7:

   >>> def whoami():
   ...     """ Return the name of the calling function.
   ...     """
   ...     import sys
   ...     return sys._getframe(1).f_code.co_name
   ...
   >>> def foobar():
   ...     print whoami()
   ...
   >>> foobar()
   foobar


Tres. -- =============================================================== Tres Seaver [EMAIL PROTECTED] Zope Corporation "Zope Dealers" http://www.zope.com


_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to