Created
February 3, 2010 22:51
-
-
Save djmitche/294139 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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