Package twisted :: Package web :: Module static :: Class Registry
[frames | no frames]

Class Registry

Versioned --+    
            |    
Componentized --+
                |
    Versioned --+
                |
               Registry


I am a Componentized object that will be made available to internal Twisted file-based dynamic web content such as .rpy and .epy scripts.
Method Summary
  __init__(self)
  _grabService(self, svc, sclas)
Find an instance of a particular class in a service collection and all subcollections.
  cachePath(self, path, rsrc)
  getCachedPath(self, path)
  getComponent(self, interface, registry)
Very similar to Componentized.getComponent, with a little magic.
  upgradeToVersion1(self)
    Inherited from Componentized
  addAdapter(self, adapterClass, ignoreClass, registry)
Utility method that calls addComponent.
  addComponent(self, component, ignoreClass, registry)
Add a component to me, for all appropriate interfaces.
  locateAdapterClass(self, klass, interfaceClass, default, registry)
  removeComponent(self, component)
Remove the given component from me entirely, for all interfaces for which it has been registered.
  setAdapter(self, interfaceClass, adapterClass)
  setComponent(self, interfaceClass, component)
  unsetComponent(self, interfaceClass)
Remove my component specified by the given interface class.
    Inherited from Versioned
  __getstate__(self, dict)
Get state, adding a version number to it on its way out.
  __setstate__(self, state)
  versionUpgrade(self)
(internal) Do a version upgrade.

Class Variable Summary
int persistenceVersion = 1                                                                     
    Inherited from Versioned
tuple persistenceForgets = ()

Method Details

_grabService(self, svc, sclas)

Find an instance of a particular class in a service collection and all subcollections.

getComponent(self, interface, registry=None)

Very similar to Componentized.getComponent, with a little magic.

This adds the additional default behavior that if no component already exists and 'interface' is a subclass of twisted.internet.app.ApplicationService, it will automatically scan through twisted.internet.app.theApplication and look for instances of 'interface'.

This has the general effect that if your web script (in an RPY, EPY, or anywhere else that a Registry is present) wishes to locate a Service in a default webserver, it can say 'registry.getComponent(MyServiceClass)' and if there is a service of that type registered with the Application, it will be found. Additionally, in a more complex server, the registry can be explicitly given a service to locate for that interface using setComponent(MyServiceClass, myServiceInstance). Separate File instances can be used to represent access to different services.
Overrides:
twisted.python.components.Componentized.getComponent

Class Variable Details

persistenceVersion

Type:
int
Value:
1                                                                     

Generated by Epydoc 2.0 on Sat Sep 13 04:21:00 2003 http://epydoc.sf.net