[Zope] introspection and DatabaseResults objects

Tom Smith tom@othermedia.com
Thu, 6 Dec 2001 12:49:19 +0000


Hi,

I've created a Python (unsafe) method called "get_related_sql()" which 
returns a list of  <Shared.DC.ZRDB.RDB.DatabaseResults instance at 
23023f0> objects.

In order to try and work out how to get the data out of these objects, I 
created another Python (unsafe) method called "inspect()" and tried 
this...

<dtml-in get_related_sql()>
<dtml-var "inspect(obj=_['sequence-item'] ) ">
</dtml-in>

inspect() contains the code...

from types import *

if type(obj) == InstanceType:
     return "instance", obj.__members__, obj.__methods__

if type(obj) == StringType:
     return "string" + ' ' + obj

But neither the __members__ or __methods__ bits work.

Any ideas how I can discover attributes and methods of arbitrary zope 
objects

thanks

--
tom smith | tom@othermedia.com
http://www.othermedia.com/blog
3rd Floor, The Pavilion, Newhams Row, London, SE1 3UZ
0207 089 5959