nti.app.pyramid_zope

https://travis-ci.org/NextThought/nti.app.pyramid_zope.svg?branch=master https://coveralls.io/repos/github/NextThought/nti.app.pyramid_zope/badge.svg?branch=master Documentation Status

This library provides a set of components (often in the zope.interface and zope.component meanings) to integrate Zope3 technologies into a modern Pyramid application.

nti.app.pyramid_zope

DOCUMENT ME.

nti.app.pyramid_zope.request

Partial support for making a Pyramid request/response object pair work more like a Zope request.

Partially based on ideas from pyramid_zope_request

class PyramidZopeRequestProxy(base)[source]

Bases: zope.proxy.decorator.SpecificationDecoratorBase

Makes a Pyramid IRequest object look like a Zope request for purposes of rendering. The existing interfaces (IRequest) are preserved.

Changes to a proxy, including annotations, are persistent, and will be reflected if the same pyramid request is proxied again later (unlike pyramid_zope_request, which takes the approach of subclassing zope.publisher.base.BaseRequest and overriding certain methods to call through to pyramid, but not things like annotations.)

Note

Most of this behaviour is added from reverse-engineering what existing zope code, most notably z3c.table.table uses. Some additional support for z3c.form comes from looking at what pyramid_zope_request does.

property environment

Alias for environ

nti.app.pyramid_zope.traversal

Support for resource tree traversal.

class ZopeResourceTreeTraverser(root)[source]

Bases: pyramid.traversal.ResourceTreeTraverser

A pyramid.interfaces.ITraverser based on pyramid’s default traverser, but modified to use the zope.traversing.api machinery instead of (only) dictionary lookups. This provides is with the flexibility of the zope.traversing.interfaces.ITraversable adapter pattern, plus the support of namespace lookups (zope.traversing.namespace.nsParse() and zope.traversing.namespace.namespaceLookup()).

As this object traverses, it fires IBeforeTraverseEvent events. If you either load the configuration from zope.app.publication or manually enable the zope.site.site.threadSiteSubscriber to subscribe to this event, then any Zope site managers found along the way will be made the current site.

__call__(request)[source]

See pyramid.interfaces.ITraversar.__call__().

__init__(root)[source]

Initialize self. See help(type(self)) for accurate signature.

class resource(context, request)[source]

Bases: zope.traversing.namespace.resource

Handles resource lookup in a way compatible with zope.browserresource. This package registers resources as named adapters from IDefaultBrowserLayer to Interface. We connect the two by making the pyramid request implement the right thing.

__init__(context, request)[source]

Initialize self. See help(type(self)) for accurate signature.

Indices and tables