[Zope3-dev] publishTraverse method in viewmeta.py

Tadashi Matsumoto ma2 at city.plala.jp
Tue Dec 13 02:27:07 EST 2005


In zope/app/publisher/browser/viewmeta.py, I found the following comment.

# This should go away, but noone seems to remember what to do. :-(

I don't know what this comment means, but the publishTraverse methods
can be rewritten by natural way. Please test this code and include into
the original if it works well. 

replace line 280-304 to the following.

    def publishTraverse(self, request, name,
                        pages=pages, getattr=getattr):

        if name in pages:
            return getattr(self, pages[name])

        return super(self.__class__, self).publishTraverse(request, name)

replace line 433-437 to the following

class simple(BrowserView):
    implements(IBrowserPublisher)

    def publishTraverse(self, request, name):

        view = zapi.queryMultiAdapter((self, request), name=name)
        if view is not None:
            return view

        raise NotFound(self, name, request)


----
Tadashi Matsumoto
ma2 at city.plala.jp


More information about the Zope3-dev mailing list