Basic Resource: zope.browserresource.resource¶
Resource base class and AbsoluteURL adapter
-
class
zope.browserresource.resource.Resource(request)[source]¶ Bases:
zope.location.location.LocationDefault implementation of
IResource.When called, this object gets a multi-adapter from itself and its request to
zope.traversing.browser.interfaces.IAbsoluteURLand returns thestrof that object.
-
class
zope.browserresource.resource.AbsoluteURL(context, request)[source]¶ Bases:
zope.traversing.browser.absoluteurl.AbsoluteURLDefault implementation of
zope.traversing.browser.interfaces.IAbsoluteURLforIResource.This object always produces URLs based on the current site and the empty view, e.g.,
path/to/site/@@/resource-name.When
stris called on this object, it will first get the current site usingzope.component.hooks.getSite. It will then attempt to adapt that site and the request tozope.traversing.browser.interfaces.IAbsoluteURLnamedresource, 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.ResourcesFor the unnamed view that the URLs we produce usually refer to.