[Zope3-Users] Absolute url of an object

Gary Poster gary at zope.com
Mon Feb 13 10:35:04 EST 2006


On Feb 10, 2006, at 9:11 PM, Paulus Zegwaard wrote:

> Hi,
>
> OK, thanks to Alen and with some further digging, I can sort of  
> answering my own question, I found some answers here:
> zope3-for-zope2-developers.pdf from Phillip von Weitershausen. Thanks
> Phillip for thinking of these legions of "poor old fashioned"  
> zopistas! ;-)
>
> So for the other newbies out there (if they search the archives  
> later):
>
>    * from Python do this: zapi.getView(obj, 'absolute_url', request) #
>      obviously import zapi first

Or see zope.app.traversing.browser.absoluteurl.absoluteURL.

>    * from a page template: obj/@@absolute_url
>
> Also without doing any extra, it seems that objects don't know their
> name anymore. No getId() or title_or_id().
> But as Alen pointed out the parent normally does some magic, so:
> you have __name__  (id in Zope 2 speak)
> and __parent__ (is obj.getParent() in Zope 2)

as long as the object provides zope.app.location.interfaces.ILocation.

> Mmm, I guess I'm gonna roll my own ordered containers

See zope.app.container.ordered .  I thought there was a folder  
variant as well, but don't see it.  Probably needs views in any case.

> and pages that
> have a title attribute.

Not sure what you mean/want.


More information about the Zope3-users mailing list