[PEAK] PyProtocols: adapting None
Phillip J. Eby
pje at telecommunity.com
Thu Mar 30 13:13:14 EST 2006
At 07:28 PM 3/30/2006 +0200, Marko Mikulicic wrote:
>My application rotates around the central point of the concept of
>adaptation, like zope does.
>It has a framework that allows users to extend using xml
>configuration files which describe adapters, and inserting a new
>behaviour description
>system is not possible. Of course I could make my current problem a
>special case and implementing it with some other means but I would like
>to use adaptation wherever possible.
I missed this part of your reply in my first read. Note that you can do
this with an interface like:
class IFoo(Interface):
def get_thing():
"""get the thing"""
class Simple(Adapter):
protocols.advise(instancesProvide=[IFoo],asAdapterForTypes=[...])
def get_thing(self):
return self.subject
And just have the code call "IFoo(ob).get_thing()" instead of just "IFoo(ob)".
More information about the PEAK
mailing list