self.context.absolute_url looks very zope2ish, absolute_url is no longer 
inherited, it is an adapted component, so I believe the accepted Zope3 way is...

from zope.app import zapi
from zope.app.traversing.browser.interfaces import IAbsoluteURL

.........

    def render(self):
        url = zapi.getMultiAdapter( (self.context, self.request), IAbsoluteURL) 
        return "<li>IAbsoluteUrl == %s/</li>" % url

 


Kevin Smith

----- Original Message ----
From: Christophe Combelles <[EMAIL PROTECTED]>
To: zope3-users@zope.org
Sent: Monday, October 2, 2006 7:14:22 PM
Subject: [Zope3-Users] absolute_url  in the viewlet ?

Hi,

How can I obtain the absolute_url of the context object in a content provider 
or 
in a viewlet ?

For example, in the demo3 of zope3demos, the render() method of the viewlet 
returns  self.context.__name__.
( http://zope3demos.googlecode.com/svn/trunk/demo3/demo.py )

How could I tell it to return the absolute_url instead of the __name__ ?

(self.context.absolute_url gives a ForbiddenAttribute error.)


thanks,
Christophe
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users



_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to