Re: [Zope3-Users] Absolute url of an object
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. ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Absolute url of an object
Hi, Sorry if I ask a question that is already asked a gazillion times, but I was not able to find the obvious answer. I'm rather new to Zope 3 and I have done a fair amount of Zope 2 development and was used to be able to create dynamic menus by iterating over the objects in the root container (site root) and traversing all the way down (or as far as i wanted). That was sort of easy because every object in Zope 2 has an absolute_url method as well as a title_or_id method. But although I understand Zope 3 has something like that too, I'm unclear how to achieve that every object provides an absolute_url method. Possibly Zope 3 has a far superior way of achiving the same goal. As a Zope 3 newbie I understand Zope 3 aims to require being explicit, yet I did like some of the implicit behavior of Zope 2 a lot. For instance I still think acquisition is bad by definition.. Maybe you should be able to turn it on or off at the folder level. A related questions is: is there an obvious way to get the site url (or object) other then just knowing the name? Can anyone point me in the right direction? BTW I have Stephan's book and ordered Phillip's book but that didn't arrive yet. Thanks Paulus ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Absolute url of an object
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 * 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) Mmm, I guess I'm gonna roll my own ordered containers and pages that have a title attribute. Cheers, Paulus Paulus Zegwaard wrote: Hi, Sorry if I ask a question that is already asked a gazillion times, but I was not able to find the obvious answer. I'm rather new to Zope 3 and I have done a fair amount of Zope 2 development and was used to be able to create dynamic menus by iterating over the objects in the root container (site root) and traversing all the way down (or as far as i wanted). That was sort of easy because every object in Zope 2 has an absolute_url method as well as a title_or_id method. But although I understand Zope 3 has something like that too, I'm unclear how to achieve that every object provides an absolute_url method. Possibly Zope 3 has a far superior way of achiving the same goal. As a Zope 3 newbie I understand Zope 3 aims to require being explicit, yet I did like some of the implicit behavior of Zope 2 a lot. For instance I still think acquisition is bad by definition.. Maybe you should be able to turn it on or off at the folder level. A related questions is: is there an obvious way to get the site url (or object) other then just knowing the name? Can anyone point me in the right direction? BTW I have Stephan's book and ordered Phillip's book but that didn't arrive yet. Thanks Paulus ___ 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