[Zope-dev] Re: DirectoryResource, Five and IAbsoluteURL

Malthe Borch mborch at gmail.com
Tue Jun 3 13:28:57 EDT 2008


Malthe Borch wrote:
> However, trying to get the absolute url of the resource fails, and it 
> seems to be an acquisition-wrapping thing.

FWIW, this adapter will do the trick, although it's hardly a solid solution:

   class SimpleResourceAbsoluteURL(object):
       interface.implements(
           zope.traversing.browser.interfaces.IAbsoluteURL)
       component.adapts(
           Products.Five.browser.resource.DirectoryResource,
           zope.publisher.interfaces.browser.IDefaultBrowserLayer)

       def __init__(self, context, request):
           self.context = context

       def __str__(self):
           return self.context()

\malthe



More information about the Zope-Dev mailing list