[Zope-dev] Zope 2.7.0 b3 regressions

Lennart Regebro regebro at nuxeo.com
Wed Dec 3 11:15:20 EST 2003


Please excuse my impatiance, but sometimes I just think it's obvious that
I'm right, and that people don't listen.
My experience of this is that I'm wrong in at least half of the cases, so
that is probably what has happened now too.

However, I took a look at the issue, and ended up with the following new
methods on Traversable:

    getVirtualRoot__roles__=None # Public
    def getVirtualRoot(self):
        try:
            req = self.REQUEST
            rpp = req.get('VirtualRootPhysicalPath', ('',))
            return rpp
        except AttributeError:
            return ('',)

    getVirtualPath__roles__=None # Public
    def getVirtualPath(self):
        root = self.getVirtualRoot()[1:]  # No point in including the root
        path = self.getPhysicalPath()[1:]
        for each in root:
            if path[0] == each:
                path = path[1:]
            else:
                break
        # And then we add the root again:
        return ('',) + path

    path2url__roles__=None # Public
    def path2url(self, path):
        return '/'.join(path)

I will check this into head this evening, and unless people scream tomorrow
I will check it into the 2.7 branch. With the above methods there will be
little use of absolute_url, and you will be able to rely on the answers.
Portal_url may need to rely on these methods, I'll look into that later.

Quick, brutal, efficient, and usually dead wrong. That's me. :-)

//Lennart





More information about the Zope-Dev mailing list