Table of Contents

Module: components Twisted-0.19.0/twisted/python/components.py

Component architecture for Twisted.

Imported modules   
import reflect
import types
import util
Functions   
getAdapter
getAdapterClass
getAdapterClassWithInheritance
getInterfaces
implements
registerAdapter
superInterfaces
tupleTreeToList
  getAdapter 
getAdapter (
        obj,
        interfaceClass,
        default,
        adapterClassLocator=None,
        )

Return an object that implements the given interface.

The result will be a wrapper around the object passed as a paramter, or the parameter itself if it already implements the interface. If no adapter can be found, the default parameter will be returned.

  getAdapterClass 
getAdapterClass (
        klass,
        interfaceClass,
        default,
        )

Return registered adapter for a given class and interface.

  getAdapterClassWithInheritance 
getAdapterClassWithInheritance (
        klass,
        interfaceClass,
        default,
        )

Return registered adapter for a given class and interface.

  getInterfaces 
getInterfaces ( obj )

Return list of all interfaces a class implements.

  implements 
implements ( obj,  interfaceClass )

Return boolean indicating if obj implements the given interface.

  registerAdapter 
registerAdapter (
        adapterClass,
        origClass,
        interfaceClass,
        )

Register an adapter class.

An adapter class is expected to implement the given interface, by adapting instances of paramter origClass. An adapter class's __init__ method should accept one parameter, an instance of origClass.

Exceptions   
ValueError, "%s instances don't implement interface %s" %( adapterClass, interfaceClass )
ValueError, "an adapter was already registered."
ValueError, "interface %s doesn't inherit from %s" %( interfaceClass, Interface )
  superInterfaces 
superInterfaces ( interface )

Given an interface, return list of super-interfaces (including itself).

  tupleTreeToList 
tupleTreeToList ( t,  l=None )

Convert an instance, or tree of tuples, into list.

Classes   
Componentized

I am a mixin to allow you to be adapted in various ways persistently.

Interface

Base class for interfaces.

_Nothing

Table of Contents

This document was automatically generated on Sun Jul 14 19:53:11 2002 by HappyDoc version 2.0