I am a mixin to allow you to be adapted in various ways persistently.
I define a list of persistent adapters. This is to allow adapter classes
to store system-specific state, and initialized on demand. The
getComponent method implements this. You must also register adapters for
this class for the interfaces that you wish to pass to getComponent.
Many other classes and utilities listed here are present in Zope3; this one
is specific to Twisted.
Methods
|
|
__init__
getComponent
locateAdapterClass
|
|
__init__
|
__init__ ( self )
|
|
getComponent
|
getComponent ( self, interface )
Create or retrieve an adapter for the given interface.
If such an adapter has already been created, retrieve it from the cache
that this instance keeps of all its adapters. Adapters created through
this mechanism may safely store system-specific state.
If you want to register an adapter that will be created through
getComponent, but you don't require (or don't want) your adapter to be
cached and kept alive for the lifetime of this Componentized object,
set the attribute temporaryAdapter to True on your adapter class.
|
|
locateAdapterClass
|
locateAdapterClass (
self,
klass,
interfaceClass,
default,
)
|
|