def declareAdapterForProtocol(protocol, adapter, proto, depth=1): """Declare that 'adapter' adapts 'proto' to 'protocol'""" adapt(protocol, IOpenProtocol) # src and dest must support IOpenProtocol adapt(proto, IOpenProtocol).addImpliedProtocol(protocol, bindAdapter(adapter, protocol), depth)
def declareAdapterForType(protocol, adapter, typ, depth=1): """Declare that 'adapter' adapts instances of 'typ' to 'protocol'""" adapter = bindAdapter(adapter, protocol) adapter = adapt(protocol, IOpenProtocol).registerImplementation(typ, adapter, depth) oi = adapt(typ, IOpenImplementor, None) if oi is not None: oi.declareClassImplements(protocol, adapter, depth)
def declareAdapterForType(protocol, adapter, typ, depth=1): """Declare that 'adapter' adapts instances of 'typ' to 'protocol'""" adapter = bindAdapter(adapter,protocol) adapter = adapt(protocol, IOpenProtocol).registerImplementation( typ, adapter, depth ) oi = adapt(typ, IOpenImplementor, None) if oi is not None: oi.declareClassImplements(protocol,adapter,depth)
def declareAdapterForObject(protocol, adapter, ob, depth=1): """Declare that 'adapter' adapts 'ob' to 'protocol'""" adapt(protocol,IOpenProtocol).registerObject(ob,bindAdapter(adapter,protocol),depth)
def declareAdapterForProtocol(protocol, adapter, proto, depth=1): """Declare that 'adapter' adapts 'proto' to 'protocol'""" adapt(protocol, IOpenProtocol) # src and dest must support IOpenProtocol adapt(proto, IOpenProtocol).addImpliedProtocol(protocol, bindAdapter(adapter,protocol), depth)
def declareAdapterForObject(protocol, adapter, ob, depth=1): """Declare that 'adapter' adapts 'ob' to 'protocol'""" adapt(protocol, IOpenProtocol).registerObject(ob, bindAdapter(adapter, protocol), depth)