Interfaces: zope.browserresource.interfaces

Resource interfaces

interface zope.browserresource.interfaces.IResource[source]

A resource.

Resources are static files and directories that are served to the browser directly from the filesystem. The most common example are images, CSS style sheets, or JavaScript files.

Resources are be registered under a symbolic name and can later be referred to by that name, so their usage is independent from their physical location.

request

Request object that is requesting the resource

__call__()

Return the absolute URL of this resource.

interface zope.browserresource.interfaces.IFileResource[source]

Extends: zope.browserresource.interfaces.IResource

A resource representing a single file.

interface zope.browserresource.interfaces.IResourceFactory[source]

A callable object to produce IResource objects.

__call__(request)

Return an IResource object

interface zope.browserresource.interfaces.IResourceFactoryFactory[source]

A factory for IResourceFactory objects

These factories are registered as named utilities that can be selected for creating resource factories in a pluggable way.

Resource directories and the <browser:resource> directive use these utilities to choose what resource to create, depending on the file extension, so third-party packages could easily plug-in additional resource types.

__call__(path, checker, name)

Return an IResourceFactory

interface zope.browserresource.interfaces.IETag[source]

An adapter for computing resource ETags.

These should be registered as multi-adapters on the resource and the request.

__call__(mtime, content)

Compute an ETag for a resource.

Parameters:
  • mtime (float) – The filesystem modification time of the resource (os.path.getmtime)
  • content (bytes) – The contents of the resource.
Returns:

A string representing the ETag, or None to disable the ETag header.