Unfortunately this doesn't work with Zope's AbsoluteURL implementation, which contains this line:
context = ILocation(context)
I never get a chance to convert ContactSet into a ContactSetLocation.
I can modify my alternate implementation of AbsoluteURL to try a multi-adapter lookup before trying a simple cast to ILocation. I'll still need the alternate AbsoluteURL but I'd be able to get rid of the IRequestAwareLocation interface. Does this make sense? Am I missing something?
Apropos getting rid of IRequestAwareLo cation: I think you were envisioning some code like this:
>>> class ContactSetLocat ion(object) : ILocation) IServiceRootRes ource, name=request. version)
... """An ILocation implementation for ContactSet objects."""
... implements(
...
... def __init__(self, context, request):
... self.context = contact_set
... self.request = request
...
... def __parent__(self, request):
... return getUtility(
...
... def __name__(self, request):
... if request.version == 'beta':
... return 'contact_list'
... return 'contacts'
>>> from zope.traversing .browser import AbsoluteURL as ZopeAbsoluteURL IAbsoluteURL)
>>> sm.registerAdapter(
... ZopeAbsoluteURL, (ILocation, IWebServiceLayer),
... provided=
>>> sm.registerAdapter(
... ContactSetLocation, (IContactSet, IWebServiceLayer),
... provided=ILocation)
Unfortunately this doesn't work with Zope's AbsoluteURL implementation, which contains this line:
context = ILocation(context)
I never get a chance to convert ContactSet into a ContactSetLocation.
I can modify my alternate implementation of AbsoluteURL to try a multi-adapter lookup before trying a simple cast to ILocation. I'll still need the alternate AbsoluteURL but I'd be able to get rid of the IRequestAwareLo cation interface. Does this make sense? Am I missing something?