[Checkins] SVN: zope.introspector/trunk/src/zope/introspector/objectinfo.py Added more info about the methods, fixed some bugs.

Martin Lundwall martin at webworks.se
Fri Aug 8 11:43:37 EDT 2008


Log message for revision 89546:
  Added more info about the methods, fixed some bugs.

Changed:
  U   zope.introspector/trunk/src/zope/introspector/objectinfo.py

-=-
Modified: zope.introspector/trunk/src/zope/introspector/objectinfo.py
===================================================================
--- zope.introspector/trunk/src/zope/introspector/objectinfo.py	2008-08-08 15:14:56 UTC (rev 89545)
+++ zope.introspector/trunk/src/zope/introspector/objectinfo.py	2008-08-08 15:43:37 UTC (rev 89546)
@@ -33,7 +33,7 @@
         
     def getType(self):
         return type(self.obj)
-
+    
     def isModule(self):
         return inspect.ismodule(self.obj)
 
@@ -50,7 +50,7 @@
     
     def getFile(self):
         try:
-            return inspect.getsourcefile(self.obj)
+            return inspect.getsourcefile(self.obj.__class__)
         except TypeError:
             try:
                 return inspect.getsourcefile(self.getType())
@@ -60,7 +60,7 @@
         
     def getAttributes(self):
         attributes = []
-        for id, value in inspect.getmembers(self.obj):
+        for id, value in inspect.getmembers(self.obj.__class__):
             if inspect.ismethod(value):
                 continue
             attributes.append({'id': id,
@@ -70,10 +70,17 @@
             
     def getMethods(self):
         methods = []
-        for id, value in inspect.getmembers(self.obj):
+        for id, value in inspect.getmembers(self.obj.__class__):
             if inspect.ismethod(value):
-                methods.append({'id': id,
-                                })
+                try:
+                    methods.append({'id': id,
+                                    'args':inspect.getargspec(value),
+                                    'comment': inspect.getcomments(value),
+                                    'doc': inspect.getdoc(value),
+                                    })
+                except:
+                    pass
+                    
         return methods
 
 class ModuleInfo(ObjectInfo):



More information about the Checkins mailing list