zope.site API
Interfaces
Interfaces for the Local Component Architecture
- interface zope.site.interfaces.IFolder[source]
Extends:
zope.container.interfaces.IContainer,zope.component.interfaces.IPossibleSite,zope.annotation.interfaces.IAttributeAnnotatableThe standard Zope Folder object interface.
- interface zope.site.interfaces.ILocalSiteManager[source]
Extends:
zope.interface.interfaces.IComponentsSite Managers act as containers for registerable components.
If a Site Manager is asked for an adapter or utility, it checks for those it contains before using a context-based lookup to find another site manager to delegate to. If no other site manager is found they defer to the global site manager which contains file based utilities and adapters.
- subs
A collection of registries that describe the next level of the registry tree. They are the children of this registry node. This attribute should never be manipulated manually. Use
addSub()andremoveSub()instead.
- addSub(sub)
Add a new sub-registry to the node.
Caution
This method should not be used manually. It is automatically called by
setNext. To add a new registry to the tree, usesub.setNext(self, self.base)instead!
- removeSub(sub)
Remove a sub-registry to the node.
Caution
This method should not be used manually. It is automatically called by
setNext. To remove a registry from the tree, usesub.setNext(None)instead!
- interface zope.site.interfaces.INewLocalSite[source]
Event: a local site was created
- manager
The new site manager
- interface zope.site.interfaces.IRootFolder[source]
Extends:
zope.location.interfaces.IRoot,zope.site.interfaces.IFolderThe standard Zope root Folder object interface.
Changed in version 4.5.0:
IRootis now defined to come beforeIFolderin the interface resolution (priority) order.
- interface zope.site.interfaces.ISiteManagementFolder[source]
Extends:
zope.container.interfaces.IContainerComponent and component registration containers.
- __parent__
- Implementation:
- Read Only:
False
- Required:
True
- Default Value:
None
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 []
- zope.site.folder.rootFolder()[source]
Factory for a
zope.site.interfaces.IRootFolder