Skip to content

Instantly share code, notes, and snippets.

@djmitche
Created February 3, 2010 22:51
Show Gist options
  • Select an option

  • Save djmitche/294139 to your computer and use it in GitHub Desktop.

Select an option

Save djmitche/294139 to your computer and use it in GitHub Desktop.
from zope.interface import Interface, implements
from twisted.python import components
class IFoo(Interface):
def snark():
"""snark"""
class Bar(object):
def poke(self):
print "POKE!"
class BarFoo(components.Adapter):
implements(IFoo)
def snark(self):
self.original.poke()
components.registerAdapter(BarFoo, Bar, IFoo)
bar = Bar()
foo = IFoo(bar)
foo.snark()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment