Log message for revision 66177: 1. Let's not be too ambitious and try to solve WebDAV issues that we don't know are actually there. 2. ZPublisher now makes sure that the request has the default skin
Changed: U Products.Five/branches/philikon-fix-lookup-priorities/traversable.py -=- Modified: Products.Five/branches/philikon-fix-lookup-priorities/traversable.py =================================================================== --- Products.Five/branches/philikon-fix-lookup-priorities/traversable.py 2006-03-26 16:35:54 UTC (rev 66176) +++ Products.Five/branches/philikon-fix-lookup-priorities/traversable.py 2006-03-26 16:37:30 UTC (rev 66177) @@ -30,8 +30,6 @@ from zExceptions import NotFound from ZPublisher import xmlrpc -_marker = object - class FakeRequest(dict): implements(IBrowserRequest) @@ -57,8 +55,8 @@ # behaviour as much as possible. Therefore the first part of # this method is based on BaseRequest.traverse's behaviour: # 1. If an object has __bobo_traverse__, use it - # 2. Otherwise do attribute look-up (w/o acquisition if necessary) - # 3. If that doesn't work, try key item lookup. + # 2. Otherwise do attribute look-up or, if that doesn't work, + # key item lookup. if hasattr(self, '__fallback_traverse__'): try: @@ -66,39 +64,18 @@ except (AttributeError, KeyError): pass else: - # Note - no_acquire_flag is necessary to support things - # like DAV. We have to make sure that the target object - # is not acquired if the request_method is other than GET - # or POST. Otherwise, you could never use PUT to add a new - # object named 'test' if an object 'test' existed above it - # in the heirarchy -- you'd always get the existing object - # :( - no_acquire_flag = False - method = REQUEST.get('REQUEST_METHOD', 'GET').upper() - if ((method not in ('GET', 'POST') or - isinstance(getattr(REQUEST, 'response', {}), xmlrpc.Response)) - and getattr(REQUEST, 'maybe_webdav_client', False)): - # Probably a WebDAV client. - no_acquire_flag = True - try: - if (no_acquire_flag and - len(REQUEST['TraversalRequestNameStack']) == 0 and - hasattr(self, 'aq_base')): - if hasattr(self.aq_base, name): - return getattr(self, name) - else: - pass # attribute not found - else: - return getattr(self, name) + return getattr(self, name) except AttributeError: - try: - return self[name] - except (KeyError, IndexError, TypeError, AttributeError): - pass # key not found + pass + try: + return self[name] + except (KeyError, IndexError, TypeError, AttributeError): + pass + # This is the part Five adds: - # 4. If neither __bobo_traverse__ nor attribute/key look-up + # 3. If neither __bobo_traverse__ nor attribute/key look-up # work, we try to find a Zope 3-style view # For that we need to make sure we have a good request @@ -108,15 +85,11 @@ REQUEST = getattr(self, 'REQUEST', None) if not IBrowserRequest.providedBy(REQUEST): REQUEST = FakeRequest() + setDefaultSkin(REQUEST) # Con Zope 3 into using Zope 2's checkPermission Products.Five.security.newInteraction() - # Set the default skin on the request if it doesn't have any - # layers set on it yet - if queryType(REQUEST, ILayer) is None: - setDefaultSkin(REQUEST) - # Use the ITraverser adapter (which in turn uses ITraversable # adapters) to traverse to a view. Note that we're mixing # object-graph and object-publishing traversal here, but Zope _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins