Viewlets

Viewlet implementations.

class zope.viewlet.viewlet.ViewletBase(context, request, view, manager)[source]

Bases: zope.publisher.browser.BrowserView

Viewlet adapter class used in meta directive as a mixin class.

class zope.viewlet.viewlet.SimpleAttributeViewlet(context, request, view, manager)[source]

Bases: zope.viewlet.viewlet.ViewletBase

A viewlet that uses a method named in __page_attribute__ to produce its content.

class zope.viewlet.viewlet.simple(context, request)[source]

Bases: zope.browserpage.simpleviewclass.simple

Simple viewlet class supporting the render() method.

render(*args, **kw)

x.__call__(…) <==> x(…)

zope.viewlet.viewlet.SimpleViewletClass(template, offering=None, bases=(), attributes=None, name=u'')[source]

A function that can be used to generate a viewlet from a set of information.

class zope.viewlet.viewlet.ResourceViewletBase[source]

Bases: object

A simple viewlet for inserting references to resources.

This is an abstract class that is expected to be used as a base only.

getURL()[source]

Retrieve the resource for our path using the ++resource++ namespace and call it, returning the results.

Commonly, the found resource will be an zope.browserresource.interfaces.IResource, which, when called, will adapt itself to zope.traversing.browser.interfaces.IAbsoluteURL and return the string value of the absolute URL.

zope.viewlet.viewlet.JavaScriptViewlet(path)[source]

Create a viewlet that can simply insert a javascript link.

class zope.viewlet.viewlet.CSSResourceViewletBase[source]

Bases: zope.viewlet.viewlet.ResourceViewletBase

zope.viewlet.viewlet.CSSViewlet(path, media='all', rel='stylesheet')[source]

Create a viewlet that can simply insert a CSS link.

class zope.viewlet.viewlet.ResourceBundleViewletBase[source]

Bases: object

A simple viewlet for inserting references to different resources.

This is an abstract class that is expected to be used as a base only.

index = None

A callable (usually a template) that is used to implement the render method.

getResources()[source]

Retrieve all the resources in our desired paths using the ++resource++ namespace

zope.viewlet.viewlet.JavaScriptBundleViewlet(paths)[source]

Create a viewlet that can simply insert javascript links.

class zope.viewlet.viewlet.CSSResourceBundleViewletBase[source]

Bases: object

A simple viewlet for inserting css references to different resources.

There is a sequence of dict used for the different resource descriptions. The sequence uses the following format:

({path:’the path’, media:’all’, rel:’stylesheet’},…)

The default values for media is all and the default value for rel is stylesheet. The path must be set there is no default value for the path attribute.

This is an abstract class that is expected to be used as a base only.

getResources()[source]

Retrieve all the resources for our desired items’ paths using the ++resource++ namespace and return a list of dictionaries.

The dictionaries are like those passed to the constructor with the defaults filled in, except that path has been replaced with url. The url object is as described for ResourceViewletBase.getURL.

zope.viewlet.viewlet.CSSBundleViewlet(items)[source]

Create a viewlet that can simply insert css links.

Parameters:items – A sequence of dictionaries as described in CSSResourceBundleViewletBase.