Martijn Faassen wrote:
Jean-Marc Orliaguet wrote:
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
OK, basically you mean that the 'annotations' given in your original
post should implement a 'setdefault' method?
Zope3-dev mailing list