[Grok-dev] Grokking an adapter factory function as a named adapter

Martin Aspeli optilude+lists at gmail.com
Sat Mar 21 23:22:40 EDT 2009


Jan-Wijbrand Kolman wrote:
> On Thu, Mar 19, 2009 at 9:55 AM, Martin Aspeli <optilude+lists at gmail.com> wrote:
>> @implementer(IMyTarget)
>> @adapter(IMyContext, name=u"my_name")
>> def my_adapter_factory(context):
>>     return ...
>>
>> That is, I want to define an adapter factory as a function, rather than
>> a class deriving from grokcore.component.Adapter, and have it grokked
>> and registered as a *named* adapter.
>>
>> Is this possible? Looking at
>> grokcore.component.meta.AdapterDecoratorGrokker, I assume not. It would
>> be really nice if there was a way to do this, though.
> 
> Hmm, I actually had a proof of concept for a named adapter decorator
> at some point. I'll need to dig it up. I agree this would be very
> useful. Could you make a feature-request issue out of this in
> lanuchpad?

Sure. How do I do that? :)

Martin

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



More information about the Grok-dev mailing list