Hi Marius,

> It's a Python 2.6/3.0 feature:

Oh... sniff... I so want that. ;)

>     from zope.component import adapter
>     from zope.interface import implementer
> 
>     @adapter(IFoo)
>     @implementer(IBar)
>     class MyClass(object):
> 
>         def __init__(self, context):
>             self.context = context
>             ...
> 
> which translates to the obvious
> 
>     class MyClass(object):
> 
>         def __init__(self, context):
>             self.context = context
>             ...
> 
>     MyClass = implementer(IBar)(MyClass)
>     MyClass = adapter(IFoo)(MyClass)
> 
> assuming I got the application order right.

Great.

> I now also wonder if adapter()/implementer() would work when called with
> classes rather than functions...?

I would hope so, or it'd be really confusing. :)

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to