Package twisted :: Package python :: Module components

[frames | no frames]

## Module twisted.python.components

Component architecture for Twisted.

Classes
`_NoImplementor` | Same as _Nothing but used by MetaInterface.__call__
`_Nothing` | An alternative to None - default value for functions which raise if default not passed.
`_Wrapper` | Makes any object be able to be dict key.
`Adapter` | I am the default implementation of an Adapter for some interface.
`AdapterRegistry` |
`Componentized` | I am a mixin to allow you to be adapted in various ways persistently.
`Interface` | Base class for interfaces.
`MetaInterface` |
`ReprableComponentized` |

Exceptions
`CannotAdapt` | Can't adapt some object to some Interface.

Function Summary
| `classToInterfaces(k)`
| ``getInterfaces`(obj, attr)` Return list of all interfaces an object implements, using a particular attribute name.
| `getRegistry(r)`
| ``implements`(obj, interfaceClass)` Return boolean indicating if obj implements the given interface.
| ``superInterfaces`(interface)` Given an interface, return list of super-interfaces (including itself).
| ``tupleTreeToList`(t, l)` Convert an instance, or tree of tuples, into list.

Variable Summary
`int` | `ALLOW_DUPLICATES` = 0
`instance method` | `getAdapter` = `twisted.python.components.AdapterRegistry.getAdapter`
`instance method` | `getAdapterClass` = `twisted.python.components.AdapterRegistry.getAdapterFactory`
`instance method` | `getAdapterClassWithInheritance` = `twisted.python.components.AdapterRegistry.getAdapterClassWithInheritance`
`instance method` | `registerAdapter` = `twisted.python.components.AdapterRegistry.registerAdapter`
`AdapterRegistry` | `theAdapterRegistry` = `<twisted.python.components.AdapterR...`

Function Details

### getInterfaces(obj, attr='__implements__')

Return list of all interfaces an object implements, using a particular attribute name. For example, if you wish to discover what interfaces a class implements directly, pass '__class_implements__' as the attribute name.

### implements(obj, interfaceClass)

Return boolean indicating if obj implements the given interface.

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

### ALLOW_DUPLICATES

  Type:
    `int`
  Value:

        0

### theAdapterRegistry

  Type:
    `AdapterRegistry`
  Value:

        <twisted.python.components.AdapterRegistry instance at 0x81989cc>

Generated by Epydoc 2.0 on Sat May 15 20:07:55 2004 | http://epydoc.sf.net