[Grok-dev] Updates to grokcore.component - maybe a release soon? :)

Martin Aspeli optilude+lists at gmail.com
Thu Apr 9 11:29:52 EDT 2009


Hi folks,

I've added some stuff I was missing in grokcore.component. Someone 
promised a release soonishly if I did that. Any hope of one?

The changelog entries are below. I stuck them under the 1.6 heading, but 
maybe it should be another 1.5.x release, I'm not sure:

* Add convenience imports for implementsOnly() and classProvides() class
   declarations form zope.interface.

* Add support for registering global adapters at module level::

     grok.global_adapter(factory, (IAdapted1, IAdapted2,), IProvided, 
name=u"name")

   Only 'factory' is required. If only a single interface is adapted, the
   second argument may be a single interface instead of a tuple. If the
   component has declared adapted/provided interfaces, the second and third
   arguments may be omitted.

* Add support for an @provider decorator to let a function directly provide
   an interface::

     @grok.provider(IFoo, IBar)
     def some_function():
         ...

   This is equivalent to doing alsoProvides(some_function, IFoo, IBar).

* Add support for named adapters with the @adapter decorator::

     @grok.adapter(IAdaptedOne, IAdaptedTwo, name=u"foo")
     def some_function(one, two):
         ...

Cheers,
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