Package twisted :: Package python :: Module components

[show private | hide private]
[frames | no frames]

## Module twisted.python.components

Component architecture for Twisted.

Classes
`Interface` | Base class for interfaces.
`Componentized` | I am a mixin to allow you to be adapted in various ways persistently.
`Adapter` | I am the default implementation of an Adapter for some interface.
`_default` |
`_Nothing` |

Function Summary
| ``implements`(obj, interfaceClass)` Return boolean indicating if obj implements the given interface.
| ``getInterfaces`(obj)` Return list of all interfaces a class implements.
| ``superInterfaces`(interface)` Given an interface, return list of super-interfaces (including itself).
| ``registerAdapter`(adapterClass, origClass, interfaceClass)` Register an adapter class.
| ``getAdapterClass`(klass, interfaceClass, default)` Return registered adapter for a given class and interface.
| ``getAdapter`(obj, interfaceClass, default, adapterClassLocator)` Return an object that implements the given interface.
| ``getAdapterClassWithInheritance`(klass, interfaceClass, default)` Return registered adapter for a given class and interface.
| ``tupleTreeToList`(t, l)` Convert an instance, or tree of tuples, into list.

Variable Summary
`dictionary` | `adapterRegistry`

Function Details

### getAdapter(obj, interfaceClass, default=<class twisted.python.components._default at..., 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(klass, interfaceClass, default)

Return registered adapter for a given class and interface.

### getAdapterClassWithInheritance(klass, interfaceClass, default)

Return registered adapter for a given class and interface.

### getInterfaces(obj)

Return list of all interfaces a class implements.

### implements(obj, interfaceClass)

Return boolean indicating if obj implements the given interface.

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

### superInterfaces(interface)

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

### tupleTreeToList(t, l=None)

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

Variable Details

### adapterRegistry

  Type:
    `dictionary`
  Value:

        {(<class twisted.web.microdom.Node at 0x80d4eac>, <class twisted.web.w\
        oven.template.INodeMutator at 0x88497bc>): <class twisted.web.woven.te\
        mplate.NodeNodeMutator at 0x869bb6c>,
         (<class twisted.internet.defer.DeferredList at 0x8178f64>, <class twi\
        sted.web.woven.interfaces.IModel at 0x84d8f0c>): <class twisted.web.wo\
        ven.model.DeferredWrapper at 0x83a604c>,
         (<class twisted.internet.defer.Deferred at 0x817bbdc>, <class twisted\
        .web.woven.interfaces.IModel at 0x84d8f0c>): <class twisted.web.woven.\
        ...

Generated by Epydoc 1.1 on Sat Feb 15 21:19:16 2003 | http://epydoc.sf.net