[Zope3-dev] Re: a new zcml directive?

Martijn Faassen faassen at infrae.com
Thu Mar 16 08:01:45 EST 2006


Jean-Marc Orliaguet wrote:
[snip]
>
> excuse me, but can someone explain what problem the pattern / workaround 
> is supposed to fix, does it create and return a default annotation value 
> in case an annotation key does not exist? shouldn't the annotation 
> machinery be "fixed" instead to provide getAnnotation(..., default=...) ?

I thought I described it in my initial post.

I was looking for a way to register annotations for objects (and create 
them if they aren't there yet) without having to write fairly long bits 
of code for each annotation factory.

I just want to be able to say:

myannotation = IFoo(obj)

where IFoo is the interface of an annotation of the obj. The only place 
I worry about it being an annotation is in the registration code. No 
need to import anything else from that package. Whether it needs to 
create a new annotation or get an existing one is an implementation detail.

Regards,

Martijn


More information about the Zope3-dev mailing list