[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/apidoc/codemodule/browser/class_.py The class browser now removes the security proxy before getting

Dmitry Vasiliev dima at hlabs.spb.ru
Sat Mar 19 15:04:44 EST 2005


Log message for revision 29577:
  The class browser now removes the security proxy before getting
  attributes information so attribute type will be displayed as expected
  

Changed:
  U   Zope3/trunk/src/zope/app/apidoc/codemodule/browser/class_.py

-=-
Modified: Zope3/trunk/src/zope/app/apidoc/codemodule/browser/class_.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/codemodule/browser/class_.py	2005-03-19 19:12:12 UTC (rev 29576)
+++ Zope3/trunk/src/zope/app/apidoc/codemodule/browser/class_.py	2005-03-19 20:04:44 UTC (rev 29577)
@@ -82,17 +82,19 @@
     def getAttributes(self):
         """Get all attributes of this class."""
         attrs = []
-        for name, attr, iface in self.context.getAttributes():
+        # remove the security proxy, so that `attr` is not proxied. We could
+        # unproxy `attr` for each turn, but that would be less efficient.
+        #
+        # `getPermissionIds()` also expects the class's security checker not
+        # to be proxied.
+        klass = removeSecurityProxy(self.context)
+        for name, attr, iface in klass.getAttributes():
             entry = {'name': name,
                      'value': `attr`,
                      'type': type(attr).__name__,
                      'type_link': getTypeLink(type(attr)),
                      'interface': getPythonPath(iface)}
-            # Since checkers do not have security declarations on their API,
-            # we have to remove the security wrapper to get to the API calls. 
-            checker = self.context.getSecurityChecker()
-            entry.update(
-                getPermissionIds(name, removeSecurityProxy(checker)))
+            entry.update(getPermissionIds(name, klass.getSecurityChecker()))
             attrs.append(entry)
         return attrs
 



More information about the Zope3-Checkins mailing list