RE: [Zope] Examining Properties of Returned Object
To all, thanks again for your help, suggestions, advice... Haven't had a chance to try things out, but I believe 1-2 of them are what I was looking for. And a correction/addition: for DocFinder, Dieter, thanks. For DocFinderEverywhere, my thanks to Stefan. It's been a big help in speeding up my learning curve. Samir. -----Original Message----- From: Troy Farrell [mailto:troy@entheossoft.com] Sent: Tuesday, May 20, 2003 22:32 To: Samir Mishra Cc: 'zope@zope.org' Subject: Re: [Zope] Examining Properties of Returned Object It sounds to me like you need the power of dir(). dir() is a builtin python function that is not accessible in zope (for security reasons I assume.) The best way to get around this is to create an external method that calls dir() with a given parameter. Troy Samir Mishra wrote:
Thanks Troy. I wasn't clear in my earlier email...
I know how to get at the attribute/method of an object if I know what it's name is. By using someobj.attributename or someobj.methodname() (or using 'getattr(....)'). But how do I enumerate all attributes & methods associated with an object when I don't know the structure of the object (i.e., as if I was exploring the object in a debugger)?
I've been using Dieter Maurer's DocFinderEverywhere extensively to get info on generic objects returned by Zope (thanks Dieter, very helpful product, especially for beginners), but obviously it has it's limitations.
Thanks again. SM.
-----Original Message----- From: Troy Farrell [mailto:troy@entheossoft.com] Sent: Tuesday, May 20, 2003 08:40 To: Samir Mishra Cc: 'zope@zope.org' Subject: Re: [Zope] Examining Properties of Returned Object
What is calling your python script? Is it TAL(ES), DTML, another python script, a zope product or an external method? Unfortunately, each of these has some slightly different methods... Did you try
obj.myattribute
or
getattr(obj, myattribute)
or (in TAL)
obj/myattribute
Thanks. Troy
Samir Mishra wrote:
Hello all,
I'm sure there's a way, just can't figure it out...
I have a python script returning an object. The result set I'm actually interested in is wrapped somewhere within this object.
My question: how can I examine the properties/methods of an object
returned
by Python?
Thanks in advance.
Regards, Samir
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
participants (1)
-
Samir Mishra