[Grok-dev] Grokking an adapter factory function as a named adapter
Martin Aspeli
optilude+lists at gmail.com
Thu Mar 19 04:55:37 EDT 2009
Hi,
I want to be able to do something like this:
from grokcore.component import adapter, implementer
@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.
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