[Zope-dev] Re: Bug in AbsoluteURL Adapter

Philipp von Weitershausen philipp at weitershausen.de
Wed Nov 28 06:01:50 EST 2007


On 28 Nov 2007, at 11:45 , Sebastian Wehrmann wrote:
>> Can you round up a test that demonstrates how the current  
>> implementation fails to cover your case and how your suggestion  
>> change fixes that?
> While trying to write a test it turned out, that it's not a problem  
> in Five but in the interaction between Plone3 and Zope2/Five.
>
> The problem we tried to solve was: We have a structure of Plone  
> content objects. We wanted to access a particular one in a view  
> which can be called anywhere. Therefore we registered this content  
> object as an utility. It turned out, that this utility does not have  
> a request after fetching it in our view with getUtility(). The  
> request is needed to get an absolute URL of our content object.

This is what I don't understand: why should content objects have  
access to the request? I understand that the request is needed in  
order to compute the absolute URL, but the IAbsoluteURL adapter is a  
*multi*-adapter for (context, request). So it will always receive the  
request explicitly in its constructor. This pattern is the foundation  
of separating content from presentation: the content object is request- 
unaware, the adapters and views around it are request-aware.



More information about the Zope-Dev mailing list