MCPcopy Create free account
hub / github.com/twisted/twisted / setAdapter

Method setAdapter

src/twisted/python/components.py:196–201  ·  view source on GitHub ↗

Cache a provider for the given interface, by adapting C{self} using the given adapter class.

(self, interfaceClass, adapterClass)

Source from the content-addressed store, hash-verified

194 return getAdapterFactory(klass, interfaceClass, default)
195
196 def setAdapter(self, interfaceClass, adapterClass):
197 """
198 Cache a provider for the given interface, by adapting C{self} using
199 the given adapter class.
200 """
201 self.setComponent(interfaceClass, adapterClass(self))
202
203 def addAdapter(self, adapterClass, ignoreClass=0):
204 """Utility method that calls addComponent. I take an adapter class and

Callers 2

test_setAdapterMethod · 0.95

Calls 1

setComponentMethod · 0.95

Tested by 2

test_setAdapterMethod · 0.76