[Zope-dev] Non-ZCML config for ZCA. (Was: Anyone want to do Google Summer of code mentoring for PSF?)
Jim Fulton
jim at zope.com
Mon Mar 21 08:03:46 EDT 2011
On Mon, Mar 21, 2011 at 7:47 AM, Lennart Regebro <regebro at gmail.com> wrote:
...
> 4. zope.interface already does, and zope.component will as well, once
> it's ported. That means we get things like:
>
> class IMyFace(Interface):
> whatevah
>
> class IMyFeet(Interface):
> something
>
> @implementer(IMyFace)
> class MyFace(object):
> yeahyeah
>
> @adapter(IMyFace, IMyFeet)
> class FootInMouth(object):
> def __init__(self, mouth, foot):
> pass
>
> The @adapter decorator so far only handles functions, but will be
> extended to classes once we port zope.component. I think also adapter
> today will only mark the object as adapts(...) does, but you will
> still use zcml to register the adapter. So probably we still need
> @adapter (as it already exists) and also another decorator (say
> @adapt() maybe?) that will both mark the class and register it in the
> registry, and hence do the same as the <adapter ... /> directive does
> today.
>
> Then we have subscriber, utility, resource and view directives.
> There's no particular reason I know of that means they couldn't be
> class decorators as well.
>
> That takes care of most of the configuration needed for the ZCA
> itself. How to deal with the rest probably gets more obvious once
> we've done this.
I'm not going to comment any more on the broader thread unless/until I
have something specific to propose. Having said that, I'd like to go
on record as wanting to review the zca port to Python 3 before it's
finalized.
Jim
--
Jim Fulton
http://www.linkedin.com/in/jimfulton
More information about the Zope-Dev
mailing list