Re: [Zope3-Users] absolute_url in the viewlet ?

2006-10-02 Thread ksmith93940-dev
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 "IAbsoluteUrl == %s/" % 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


Re: [Zope3-Users] absolute_url in the viewlet ?

2006-10-02 Thread Fred Drake

On 10/2/06, Christophe Combelles <[EMAIL PROTECTED]> wrote:

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


Is there some reason the usual context/@@absolute_url doesn't work?


 -Fred

--
Fred L. Drake, Jr.
"Every sin is the result of a collaboration." --Lucius Annaeus Seneca
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] absolute_url in the viewlet ?

2006-10-02 Thread Christophe Combelles

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