[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZMI - ZMIViewUtility.py:1.1.2.11
Steve Alexander
steve@cat-box.net
Mon, 10 Jun 2002 17:31:03 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/ZMI
In directory cvs.zope.org:/tmp/cvs-serv5189/lib/python/Zope/App/ZMI
Modified Files:
Tag: Zope-3x-branch
ZMIViewUtility.py
Log Message:
made ZMI tabs appear appropriate to the permissions of the principal
making the request.
=== Zope3/lib/python/Zope/App/ZMI/ZMIViewUtility.py 1.1.2.10 => 1.1.2.11 ===
from Zope.App.ZopePublication.PublicationTraverse \
import PublicationTraverser
-from Zope.Exceptions import Unauthorized
+from Zope.Exceptions import Unauthorized, Forbidden
from Interface import Interface
+
class IZMIViewUtility(Interface):
def getZMIViews():
"""Get available view information
@@ -48,9 +49,12 @@
action=view[1]
if action:
try:
- traverser.traversePath(request, context, action)
- except Unauthorized:
- continue # Skip unauthorized
+ # tickle the security proxy's checker
+ # we're assuming that view pages are callable
+ # this is a pretty sound assumption
+ traverser.traversePath(request, context, action).__call__
+ except (Unauthorized, Forbidden):
+ continue # Skip unauthorized or forbidden
zmi_views.append({'label': label, 'action': "%s" % action})
return zmi_views