Part of twisted.python View Source
Component architecture for Twisted, based on Zope3 components.
Using the Zope3 API directly is strongly recommended. Everything you need is in the top-level of the zope.interface package, e.g.:
from zope.interface import Interface, implements
class IFoo(Interface):
pass
class Foo:
implements(IFoo)
print IFoo.implementedBy(Foo) # True
print IFoo.providedBy(Foo()) # True
The one exception is twisted.python.components.registerAdapter,
which is still the way to register adapters (at least, if you want
Twisted's global adapter registry).
| Class | ComponentsDeprecationWarning | Nothing emits this warning anymore. |
| Function | _registered 0 | Return the adapter factory for the given parameters in the given |
| Function | _registered | Return the adapter factory for the given parameters in the given |
| Function | registerAdapter | Register an adapter class. |
| Function | getAdapterFactory | Return registered adapter for a given class and interface. |
| Function | _hook | Undocumented |
| Function | backwardsCompatImplements | DEPRECATED. |
| Function | fixClassImplements | DEPRECATED. |
| Function | getRegistry | Returns the Twisted global |
| Class | Adapter | I am the default implementation of an Adapter for some interface. |
| Class | Componentized | I am a mixin to allow you to be adapted in various ways persistently. |
| Class | ReprableComponentized | Undocumented |
Register an adapter class.
An adapter class is expected to implement the given interface, by adapting instances implementing 'origInterface'. An adapter class's __init__ method should accept one parameter, an instance implementing 'origInterface'.Return registered adapter for a given class and interface.
Note that is tied to the *Twisted* global registry, and will thus not find adapters registered elsewhere.DEPRECATED.
Does nothing. Previously handled backwards compat from a zope.interface using class to a class wanting old twisted components interface behaviors.DEPRECATED.
Does nothing. Previously converted class from __implements__ to zope implementation.zope.interface.adapter.AdapterRegistry instance.