[z3-checkins] r5325 - z3/Five/trunk
faassen at codespeak.net
faassen at codespeak.net
Fri Jun 25 19:56:06 MEST 2004
Author: faassen
Date: Fri Jun 25 19:56:05 2004
New Revision: 5325
Removed:
z3/Five/trunk/viewattribute.py
Log:
Remove unused code in viewattribute.py.
Deleted: /z3/Five/trunk/viewattribute.py
==============================================================================
--- /z3/Five/trunk/viewattribute.py Fri Jun 25 19:56:05 2004
+++ (empty file)
@@ -1,61 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2004 Five Contributors. All rights reserved.
-#
-# This software is distributed under the terms of the Zope Public
-# License (ZPL) v2.1. See COPYING.txt for more information.
-#
-##############################################################################
-"""View attribute machinery
-
-$Id$
-"""
-import Acquisition
-from AccessControl import getSecurityManager
-from zExceptions import Unauthorized
-
-from zope.component import getView
-
-class FiveViewError(Exception):
- pass
-
-class ViewAttribute(Acquisition.Explicit):
-
- def __init__(self, view_type):
- self._view_type = view_type
-
- def index_html(self):
- """Default method on view
- """
- # need this info to do security checks, so can't delegate to
- # __getitem__
- obj = self.aq_parent
- view = getView(obj, self._view_type, self.aq_acquire('REQUEST'))
- view = view.__of__(obj)
- method_on_view = getattr(view, 'index_html', None)
- if method_on_view is None:
- raise FiveViewError, "No default view (index_html)"
- security_manager = getSecurityManager()
- if not security_manager.validate(method_on_view, obj, 'index_html',
- method_on_view):
- raise Unauthorized
- return method_on_view()
-
- def __getitem__(self, name):
- """Get correct method on view
- """
- # get the object we are viewing
- obj = self.aq_parent
- # look up the view
- view = getView(obj, self._view_type, self.aq_acquire('REQUEST'))
- # wrap it in the right acquisition context for security
- view = view.__of__(obj)
- # look up method
- method_on_view = getattr(view, name, None)
-
- if method_on_view is None:
- # we do not accept calling unknown methods
- raise FiveViewError, "Unknown view method: %s" % name
-
- # let the ZPublisher do the calling, its security kicks in
- return method_on_view
More information about the z3-checkins
mailing list