[Grok-dev] Grokking an adapter factory function as a named adapter
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Sat Mar 21 15:36:17 EDT 2009
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?
regards,
jw
--
Jan-Wijbrand Kolman
More information about the Grok-dev
mailing list