Hi,

I know we should not make the URL to a content like this:

url = item.absolute_url()

This does not work for files, images, and perhaps other third party content 
types which "absolute_url()" is the download URL and not a regular Plone view 
page URL.

The workaround I found is somehow noisy (but works as expected) :

from zope.component import getMultiAdapter
...
content_view = getMultiAdapter((item, request), name=u'plone_context_state')
url = content_view.view_url()

Is there something that's less verbose around ?

Cheers
-- 
Gilles Lenfant

_______________________________________________
Product-Developers mailing list
Product-Developers@lists.plone.org
https://lists.plone.org/mailman/listinfo/product-developers

Reply via email to