zope.site API
Interfaces
Interfaces for the Local Component Architecture
Implementations
Site
Site and Local Site Manager implementation
A local site manager has a number of roles:
A local site manager, that provides a local adapter and utility registry.
A place to do TTW development and/or to manage database-based code.
A registry for persistent modules. The Zope 3 import hook uses the SiteManager to search for modules.
- class zope.site.site.LocalSiteManager(site, default_folder=True)[source]
Bases:
BTreeContainer,PersistentComponentsLocal Site Manager (
ILocalSiteManager) implementation
- class zope.site.site.SMFolderFactory(context)[source]
Bases:
objectImplementation of a
IDirectoryFactorythat createsSiteManagementFolder
- class zope.site.site.SiteManagementFolder[source]
Bases:
BTreeContainerImplementation of a
ISiteManagementFolder
- class zope.site.site.SiteManagerContainer[source]
Bases:
ContainedImplement access to the site manager (++etc++site).
This is a mix-in that implements the
IPossibleSiteinterface; for example, it is used by the Folder implementation.
- zope.site.site.SiteManagerAdapter(ob)[source]
An adapter from
ILocationtoIComponentLookup.The ILocation is interpreted flexibly, we just check for
__parent__.
- zope.site.site.changeSiteConfigurationAfterMove(site, event)[source]
After a site is (re-)moved, its site manager links have to be updated.
Subscriber to
ISiteobjects in aIObjectMovedEvent.
- zope.site.site.clearThreadSiteSubscriber(event)[source]
A subscriber to
zope.publisher.interfaces.EndRequestEventCleans up the site thread global after the request is processed.
Note
The
configure.zcmlincluded in this package does not install this subscriber. That must be configured separately.zope.app.publicationincludes such configuration.
- zope.site.site.threadSiteSubscriber(ob, event)[source]
A multi-subscriber to
zope.component.interfaces.ISiteandzope.traversing.interfaces.BeforeTraverseEvent.Sets the ‘site’ thread global if the object traversed is a site.
Note
The
configure.zcmlincluded in this package does not install this subscriber. That must be configured separately.zope.app.publicationincludes such configuration.
Folder
- class zope.site.folder.Folder[source]
Bases:
Folder,SiteManagerContainerImplementation of
zope.site.interfaces.IFolder
- class zope.site.folder.FolderSublocations(folder)[source]
Bases:
objectAdapter for an
zope.site.interfaces.IFoldertozope.location.interfaces.ISublocations.The subobjects of a folder include it’s contents and it’s site manager if it is a site:
>>> from zope.container.contained import Contained >>> folder = Folder() >>> folder['ob1'] = Contained() >>> folder['ob2'] = Contained() >>> folder['ob3'] = Contained() >>> subs = list(FolderSublocations(folder).sublocations()) >>> subs.remove(folder['ob1']) >>> subs.remove(folder['ob2']) >>> subs.remove(folder['ob3']) >>> subs [] >>> sm = Contained() >>> from zope.interface import directlyProvides >>> from zope.interface.interfaces import IComponentLookup >>> directlyProvides(sm, IComponentLookup) >>> folder.setSiteManager(sm) >>> directlyProvides(folder, zope.component.interfaces.ISite) >>> subs = list(FolderSublocations(folder).sublocations()) >>> subs.remove(folder['ob1']) >>> subs.remove(folder['ob2']) >>> subs.remove(folder['ob3']) >>> subs.remove(sm) >>> subs []