On Fri, May 30, 2008 at 3:03 PM, Martijn Faassen <[EMAIL PROTECTED]> wrote: > Benji York wrote: >> I have an app that allows the same object to be reachable via several >> URLs. When we wanted one of the URLs to be preferred (none are really >> "cononical" in my case), then we did just as you suggest above and added >> a way for the IAbsoluteURL adapter(s) to know which URL was preferred. >> It worked out quite well. > > Cool. Where does the adapter get the information to make a decision from? I > mean, how does it know to use URL A and not URL B?
Nothing fancy: we adapt the object to (names changed to clarify the example) IPreferredLocations to get back a list ordered by how preferred the locations are (from most-preferred to least), we then simply iterate over the list (it's always short) until we find the first place the object is visible, and use it. The location ordering is specified by the user (more or less, there are details I'm leaving out). -- Benji York Senior Software Engineer Zope Corporation _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )