All pastes #485137 Raw Edit

Stuff

public python v1 · immutable
·published 2007-05-12 21:47 UTC
rendered paste body
registry = {}def registerPlugin(name, plugin):    registry[name] = pluginclass IPlugin(zope.interface):    def doStuff():        """ does stuff """class PluginA(object):    implements(IPlugin)    def doStuff(self):        print str(self), "is doing stuff"class PluginB(PluginA):    implements(IPlugin)    print str(self), "is doing stuff"registerPlugin("A", PluginA())registerPlugin("B", PluginB())registry["A"].doStuff()registry["B"].doStuff()