[Zope3-dev] a new zcml directive?

Martijn Faassen faassen at infrae.com
Mon Mar 13 06:20:07 EST 2006


Marius Gedminas wrote:
[snip]
> -1
> 
> I'd prefer
> 
> from zope.annotation.adapter import AnnotationAdapter
> 
> getFoo = AnnotationAdapter(for_=IBar, 
 >                            interface=IFoo,
 >                            factory=Foo,
>                            key=FOO_KEY) 
 > # I suppose the key could be optional; you could use a
 > # dotted interface name by default
> 
> and then the ordinary
> 
> <zope:adapter factory=".foo.getFoo" />
> 
> I think this is exactly the same as Jeff Shell's suggestion, but its 
> 3am, and I'm too tired to read his entire message.

I guess it comes down to the question whether annotations are a basic 
configuration concept, like views, and thus have their own directive to 
register them, or not.

In your example, the ZCML doesn't show that we actually are setting up 
an annotation, and it doesn't show for what we're setting up an 
annotation for in the first place either. It's one intrepretation of 
ZCML that it should show these things. The other interpretation of ZCML 
is that its main task is just hooking components into the system.

Perhaps we should make explicit which ZCML we want to have, as its 
design can be quite different depending on that choice.

Regards,

Martijn


More information about the Zope3-dev mailing list