[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/Browser - PublicationTraverse.py:1.1

Jim Fulton jim@zope.com
Thu, 20 Jun 2002 17:47:46 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/Browser
In directory cvs.zope.org:/tmp/cvs-serv19679/lib/python/Zope/App/ZopePublication/Browser

Added Files:
	PublicationTraverse.py 
Log Message:
Fixed a bunch of bugs that prevented custom add views from working.



=== Added File Zope3/lib/python/Zope/App/ZopePublication/Browser/PublicationTraverse.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""XXX short summary goes here.

XXX longer description goes here.

$Id: PublicationTraverse.py,v 1.1 2002/06/20 21:47:45 jim Exp $
"""
__metaclass__ = type

from Zope.App.ZopePublication.PublicationTraverse \
     import PublicationTraverser as PublicationTraverser_
from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher
from Zope.ComponentArchitecture import queryAdapter

class PublicationTraverser(PublicationTraverser_):    

    def traverseRelativeURL(self, request, ob, path):

        ob = self.traversePath(request, ob, path)

        while 1:
            adapter = queryAdapter(ob, IBrowserPublisher)
            if adapter is None:
                return ob
            ob, path = adapter.browserDefault(request)
            if not path:
                return ob
                        
            ob = self.traversePath(request, ob, path)