Hi,

Am 28.11.2007 um 12:01 schrieb Philipp von Weitershausen:
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.

Exactly, thats why we thought this may be a bug. The __str__ method of Five's AbsoluteURL adapter does not make use of the request the adapter gets in its constructor, it just calls the zope2-ish absolute_url() method on the context. (Which itself relies on the REQUEST attribute of the object to convert the path to an URL)


Bye,
Daniel
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to