Table of Contents

Module: components | Twisted-0.17.4/twisted/python/components.py
--- | ---

Component architecture for Twisted.

Imported modules |
--- | ---
import reflect import util
Functions |
classImplements getAdapter getAdapterClass getInterfaces implements registerAdapter superInterfaces
| classImplements

    classImplements ( klass,  interfaceClass )

Return boolean indicating if class implements the given interface.

| getAdapter

    getAdapter (
            obj,
            interfaceClass,
            default,
            )

### 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.

| getInterfaces

    getInterfaces ( klass )

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 doesn'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).

Classes |

Interface | Base class for interfaces.

Table of Contents

This document was automatically generated on Sat Apr 20 01:31:23 2002 by HappyDoc version 2.0