Skip to content

Commit

Permalink
Reinstantiated some removeAllProxies calls, since we need do not want…
Browse files Browse the repository at this point in the history
… the

location proxy's mosule, but the interface's.
  • Loading branch information
strichter committed Aug 26, 2004
1 parent 5159732 commit f1286d3
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ifacemodule/browser.py
Expand Up @@ -242,8 +242,9 @@ def getDoc(self):
>>> details.getDoc()[:34]
'<h1>This is the Foo interface</h1>'
"""
# We must remove all security proxies here, so that we get the context's
# __module__ attribute.
# We must remove all proxies here, so that we get the context's
# __module__ attribute. If we only remove security proxies, the
# location proxy's module will be returned.
return renderText(self.context.__doc__,
zapi.removeSecurityProxy(self.context).__module__)

Expand Down Expand Up @@ -314,8 +315,9 @@ def getAttributes(self):
"""
# The `Interface` and `Attribute` class have no security declarations,
# so that we are not able to access any API methods on proxied
# objects.
iface = zapi.removeSecurityProxy(self.context)
# objects. If we only remove security proxies, the location proxy's
# module will be returned.
iface = removeAllProxies(self.context)
attrs = []
for name in iface:
attr = iface[name]
Expand Down Expand Up @@ -344,12 +346,14 @@ def getMethods(self):
('signature', '(key, default=None)')]]
"""
# The `Interface` class have no security declarations, so that we are
# not able to access any API methods on proxied objects.
# not able to access any API methods on proxied objects. If we only
# remove security proxies, the location proxy's module will be
# returned.
return [{'name': method.getName(),
'signature': method.getSignatureString(),
'doc': renderText(
method.getDoc() or '',
zapi.removeSecurityProxy(self.context).__module__)}
removeAllProxies(self.context).__module__)}
for method in _get(self.context, IMethod).values()]

def getFields(self):
Expand Down Expand Up @@ -384,7 +388,9 @@ def getFields(self):
('required', u'optional')]]
"""
# The `Interface` class have no security declarations, so that we are
# not able to access any API methods on proxied objects.
# not able to access any API methods on proxied objects. If we only
# remove security proxies, the location proxy's module will be
# returned.
fields = map(lambda x: x[1], _getInOrder(self.context, IField))
return [{'name': field.getName(),
'iface': _getFieldInterface(field),
Expand All @@ -393,7 +399,7 @@ def getFields(self):
'default': field.default.__repr__(),
'description': renderText(
field.description or '',
zapi.removeSecurityProxy(self.context).__module__)}
removeAllProxies(self.context).__module__)}
for field in fields]

def getRequiredAdapters(self):
Expand Down

0 comments on commit f1286d3

Please sign in to comment.