Movatterモバイル変換


[0]ホーム

URL:


Go to the latest version of this document.

t.p.components : module documentation

Part oftwisted.pythonView 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

twisted.python.components.registerAdapterfrom this module may be used to add to Twisted's global adapter registry.

twisted.python.components.proxyForInterfaceis a factory for classes which allow access to only the parts of another class defined by a specified interface.
ClassComponentsDeprecationWarningNothing emits this warning anymore.
FunctionregisterAdapterRegister an adapter class.
FunctiongetAdapterFactoryReturn registered adapter for a given class and interface.
FunctionbackwardsCompatImplementsDEPRECATED.
FunctionfixClassImplementsDEPRECATED.
FunctiongetRegistryReturns the Twisted globalzope.interface.adapter.AdapterRegistry instance.
ClassAdapterI am the default implementation of an Adapter for some interface.
ClassComponentizedI am a mixin to allow you to be adapted in various ways persistently.
ClassReprableComponentizedUndocumented
FunctionproxyForInterfaceCreate a class which proxies all method calls which adhere to an interface to another provider of that interface.
Function_registered 0Return the adapter factory for the given parameters in the given registry, or None if there is not one.
Function_registeredReturn the adapter factory for the given parameters in the given registry, or None if there is not one.
Function_hookUndocumented
Class_ProxiedClassMethodA proxied class method.
Class_ProxyDescriptorA descriptor which will proxy attribute access, mutation, and deletion to theoriginal attribute of the object it is being accessed from.
def _registered 0(registry, required, provided): (source)
Return the adapter factory for the given parameters in the given registry, or None if there is not one.
def _registered(registry, required, provided): (source)
Return the adapter factory for the given parameters in the given registry, or None if there is not one.
def registerAdapter(adapterFactory, origInterface, *interfaceClasses): (source)

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'.
def getAdapterFactory(fromInterface, toInterface, default): (source)

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.
def _hook(iface, ob, lookup=globalRegistry.lookup1): (source)
Undocumented
def backwardsCompatImplements(klass): (source)

DEPRECATED.

Does nothing. Previously handled backwards compat from a zope.interface using class to a class wanting old twisted components interface behaviors.
def fixClassImplements(klass): (source)

DEPRECATED.

Does nothing. Previously converted class from __implements__ to zope implementation.
def getRegistry(): (source)
Returns the Twisted globalzope.interface.adapter.AdapterRegistry instance.
def proxyForInterface(iface, originalAttribute='original'): (source)

Create a class which proxies all method calls which adhere to an interface to another provider of that interface.

This function is intended for creating specialized proxies. The typical way to use it is by subclassing the result:
 class MySpecializedProxy(proxyForInterface(IFoo)):     def someInterfaceMethod(self, arg):         if arg == 3:             return 3         return self.original.someInterfaceMethod(arg)
ParametersifaceThe Interface to which the resulting object will conform, and which the wrapped object must provide.
originalAttributename of the attribute used to save the original object in the resulting class. Default tooriginal. (type:str)
ReturnsA class whose constructor takes the original object as its only argument. Constructing the class creates the proxy.
API Documentation forTwisted, generated bypydoctor at 2011-10-27 16:27:37.
[8]ページ先頭

©2009-2026 Movatter.jp