Basic Resource: zope.browserresource.resource

Resource base class and AbsoluteURL adapter

class zope.browserresource.resource.Resource(request)[source]

Bases: zope.location.location.Location

Default implementation of IResource.

When called, this object gets a multi-adapter from itself and its request to zope.traversing.browser.interfaces.IAbsoluteURL and returns the str of that object.

class zope.browserresource.resource.AbsoluteURL(context, request)[source]

Bases: zope.traversing.browser.absoluteurl.AbsoluteURL

Default implementation of zope.traversing.browser.interfaces.IAbsoluteURL for IResource.

This object always produces URLs based on the current site and the empty view, e.g., path/to/site/@@/resource-name.

When str is called on this object, it will first get the current site using zope.component.hooks.getSite. It will then attempt to adapt that site and the request to zope.traversing.browser.interfaces.IAbsoluteURL named resource, and if that isn’t available it will use the unnamed adapter. The URL of that object (i.e., the URL of the site) will be combined with the name of the resource to produce the final URL.

See also

zope.browserresource.resources.Resources For the unnamed view that the URLs we produce usually refer to.