These classes and functions are also available from the top-level protocols package. In contrast to the items already covered, these classes and functions are generally needed only when extending the protocols framework, as opposed to merely using it.
declare
or advise
.)
To create protocols dynamically, you can create individual Protocol instances, and then use them with the declaration API. You can also subclass Protocol to create your own protocol types. If you override __init__, however, be sure to call Protocol.__init__() in your subclass' __init__ method.
baseProtocol [, context=None]) |
name, bases, dictionary) |
name, bases, dictionary) |
New in version . ) |
So, to support IOpenprovider with a custom __conform__
method, subclass ProviderMixin, and have your __conform__
method invoke the base __conform__ method as a default, using
supermeta(). (E.g. return
supermeta(MyClass,self).__conform__(protocol)
.) See below for more on
the supermeta() function.
func) |
typ, ob) |
Note that if you are subclassing ProviderMixin or Protocol, you will need to use supermeta() to call almost any inherited methods, since most of the methods provided are wrapped with metamethod().
protocol, adapter, typ [, depth=1]) |
protocol, adapter, ob [, depth=1]) |
protocol, adapter, proto [, depth=1]) |
adapt(proto,IOpenProtocol).addImpliedProtocol(protocol,adapter,depth)
.