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

Viktorija Zaksiene ryzaja@codeworks.lt
Thu, 5 Jun 2003 05:47:38 -0400


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

Modified Files:
	checker.py 
Log Message:
Make checker debugging messages more readable and more grep friendly
(Vika & Marius)


=== Zope3/src/zope/security/checker.py 1.29 => 1.30 ===
--- Zope3/src/zope/security/checker.py:1.29	Wed Jun  4 18:25:00 2003
+++ Zope3/src/zope/security/checker.py	Thu Jun  5 05:47:37 2003
@@ -330,52 +330,49 @@
     """
 
     def check(self, object, name):
-        print >> sys.stderr, ('Checking %r.%s:' % (object, name)),
         try:
             super(CheckerLoggingMixin, self).check(object, name)
             if name in _always_available:
-                print >> sys.stderr, 'Always available.'
+                print >> sys.stderr, '[CHK] + Always available: %s on %r' % (name, object)
             elif self.permission_id(name) is CheckerPublic:
-                print >> sys.stderr, 'Public.'
+                print >> sys.stderr, '[CHK] + Public: %s on %r' % (name, object)
             else:
-                print >> sys.stderr, 'Granted.'
+                print >> sys.stderr, '[CHK] + Granted: %s on %r' % (name, object)
         except Unauthorized:
-            print >> sys.stderr, 'Unauthorized.'
+            print >> sys.stderr, '[CHK] - Unauthorized: %s on %r' % (name, object)
             raise
         except ForbiddenAttribute:
-            print >> sys.stderr, 'Forbidden.'
+            print >> sys.stderr, '[CHK] - Forbidden: %s on %r' % (name, object)
             raise
 
     def check_getattr(self, object, name):
-        print >> sys.stderr, ('Checking get %r.%s:' % (object, name)),
         try:
             super(CheckerLoggingMixin, self).check(object, name)
             if name in _always_available:
-                print >> sys.stderr, 'Always available.'
+                print >> sys.stderr, '[CHK] + Always available getattr: %s on %r' % (name, object)
             elif self.permission_id(name) is CheckerPublic:
-                print >> sys.stderr, 'Public.'
+                print >> sys.stderr, '[CHK] + Public getattr: %s on %r' % (name, object)
             else:
-                print >> sys.stderr, 'Granted.'
+                print >> sys.stderr, '[CHK] + Granted getattr: %s on %r' % (name, object)
         except Unauthorized:
-            print >> sys.stderr, 'Unauthorized.'
+            print >> sys.stderr, '[CHK] - Unauthorized getattr: %s on %r' % (name, object)
             raise
         except ForbiddenAttribute:
-            print >> sys.stderr, 'Forbidden.'
+            print >> sys.stderr, '[CHK] - Forbidden getattr: %s on %r' % (name, object)
             raise
 
     def check_setattr(self, object, name):
-        print >> sys.stderr, ('Checking set %r.%s:' % (object, name)),
         try:
             super(CheckerLoggingMixin, self).check_setattr(object, name)
             if self.setattr_permission_id(name) is CheckerPublic:
-                print >> sys.stderr, 'Public.'
+                print >> sys.stderr, '[CHK] + Public setattr: %s on %r' % (name, object)
             else:
-                print >> sys.stderr, 'Granted.'
+                print >> sys.stderr, '[CHK] + Granted setattr: %s on %r' % (name, object)
         except Unauthorized:
-            print >> sys.stderr, 'Unauthorized.'
+            print >> sys.stderr, '[CHK] - Unauthorized setattr: %s on %r' % (name, object)
             raise
         except ForbiddenAttribute:
-            print >> sys.stderr, 'Forbidden.'
+            print >> sys.stderr, '[CHK] - Forbidden setattr: %s on %r' % (name, object)
             raise
 
 if WATCH_CHECKERS: