[Zope3-checkins] CVS: Zope3/src/zope/security - checker.py:1.17

Guido van Rossum guido@python.org
Tue, 22 Apr 2003 12:22:37 -0400


Update of /cvs-repository/Zope3/src/zope/security
In directory cvs.zope.org:/tmp/cvs-serv22243

Modified Files:
	checker.py 
Log Message:
Report obj.__class__ as well as type(obj) in the TracebackSupplement.


=== Zope3/src/zope/security/checker.py 1.16 => 1.17 ===
--- Zope3/src/zope/security/checker.py:1.16	Mon Apr 21 17:04:37 2003
+++ Zope3/src/zope/security/checker.py	Tue Apr 22 12:22:37 2003
@@ -197,14 +197,20 @@
         result = []
         try:
             cls = self.obj.__class__
+            if hasattr(cls, "__module__"):
+                s = "%s.%s" % (cls.__module__, cls.__name__)
+            else:
+                s = str(cls.__name__)
+            result.append("   - class: " + s)
         except:
-            cls = type(self.obj)
+            pass
         try:
+            cls = type(self.obj)
             if hasattr(cls, "__module__"):
                 s = "%s.%s" % (cls.__module__, cls.__name__)
             else:
                 s = str(cls.__name__)
-            result.append("   - class: " + s)
+            result.append("   - type: " + s)
         except:
             pass
         return "\n".join(result)