[Zope] a simple design problem, a Zope bug and a fix

Brian Lloyd brian.lloyd@zope.com
Mon, 8 Oct 2001 14:04:56 -0400


> And now we came to a bug description: I claim that absolute_url()
> method of the Traversable class has a bug, at least in Zope 2.4.1
> 
> The bug causes incorrect URL returned sometimes when a it is executed
> on an aquired object.  For instance, if in object /F/O I evaluate
> self.container.absolute_url() what I get will depend on the request
> context:
> 
>   if the requested url was: "http://site/F/something", then the URL
>   returned in object O will be fine: "http://site/F"
> 
>   if the requested url was: "http://site/F/SF/something", then the URL
>   returned *might* be "http://site/F/SF/something/F". 
> 
> *Might* here means that if the absolute_url() is executed in a Product
> class definition, it will go wrong, but if it is executed from a
> python script (like the one above), it will work fine.  I suppose that
> has something to do to with the context (namespace) transfer to python
> scripts.
> 
> 
> Finally, a fix: I'm far from well-understanding the change I made to
> the Zope code, but it works better for me now.  I attach to this
> message a patch for Traversable.py file.

This patch appears to break the absolute_url method in many cases.

It would be good if we could get a better description of the bug
(a reproducable test case) so that we can follow up on this.


Brian Lloyd        brian@zope.com
Software Engineer  540.361.1716       
Zope Corporation   http://www.zope.com