[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/app/ Add __traceback_info__ to zope.app.traversing.adapters, as it seems its a very common place to have errors when you mistype something on a view template, and no info was provided that could help finding the source of the problem. Fix a typo and clarify by adding a comment the code inside protectclass.

Sidnei da Silva sidnei at awkly.org
Fri Jul 9 15:57:50 EDT 2004


Log message for revision 26368:
Add __traceback_info__ to zope.app.traversing.adapters, as it seems its a very common place to have errors when you mistype something on a view template, and no info was provided that could help finding the source of the problem. Fix a typo and clarify by adding a comment the code inside protectclass.


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/security/protectclass.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/security/protectclass.py	2004-07-09 19:41:20 UTC (rev 26367)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/security/protectclass.py	2004-07-09 19:57:50 UTC (rev 26368)
@@ -34,7 +34,7 @@
         # Translate public permission to CheckerPublic
         permission = CheckerPublic
 
-    # We know a dictionart get method was used because we set it
+    # We know a dictionary was used because we set it
     protections = checker.get_permissions
     protections[name] = permission
 
@@ -50,7 +50,13 @@
         # Translate public permission to CheckerPublic
         permission = CheckerPublic
 
-    # We know a dictionart get method was used because we set it
+    # We know a dictionary was used because we set it
+    # Note however, that if a checker was created manually
+    # and the caller used say NamesChecker or MultiChecker,
+    # then set_permissions may be None here as Checker
+    # defaults a missing set_permissions parameter to None.
+    # Jim says this doensn't happens with the C version of the
+    # checkers because they use a 'shared dummy dict'.
     protections = checker.set_permissions
     protections[name] = permission
 
@@ -61,7 +67,13 @@
     if unto_checker is None:
         return
 
-    # We know a dictionart get method was used because we set it
+    # We know a dictionary was used because we set it
+    # Note however, that if a checker was created manually
+    # and the caller used say NamesChecker or MultiChecker,
+    # then set_permissions may be None here as Checker
+    # defaults a missing set_permissions parameter to None.
+    # Jim says this doensn't happens with the C version of the
+    # checkers because they use a 'shared dummy dict'.
     unto_get_protections = unto_checker.get_permissions
     unto_set_protections = unto_checker.set_permissions
 
@@ -70,7 +82,6 @@
         checker = Checker({}, {})
         defineChecker(class_, checker)
 
-    # OK, so it's a hack.
     get_protections = checker.get_permissions
     for name in unto_get_protections:
         get_protections[name] = unto_get_protections[name]

Modified: Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/adapters.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/adapters.py	2004-07-09 19:41:20 UTC (rev 26367)
+++ Zope3/branches/ZopeX3-3.0/src/zope/app/traversing/adapters.py	2004-07-09 19:57:50 UTC (rev 26368)
@@ -40,6 +40,7 @@
 
     def traverse(self, name, furtherPath):
         subject = self._subject
+        __traceback_info__ = (subject, name, furtherPath)
         attr = getattr(subject, name, _marker)
         if attr is not _marker:
             # TODO: It is pretty obvious that we should call methods.



More information about the Zope3-Checkins mailing list