I notice a pattern in code that uses annotations that looks like this:
class Foo(Persistent, Contained):
annotations = IAnnotations(context)
foo = Foo()
annotations[FOO_KEY] = foo
# to please security...
foo, context, 'foo')
# Convention to make adapter introspectable
getFoo.factory = Foo
If I'm doing this quite a bit, this looks like something that would be
better expressed in a... new ZCML directive (..waiting for the crowd to
start flinging stones).
For instance, one that looks like this:
<zope:annotation for="IBar" factory="Foo" />
where the factory actually points to whatever creates the real
annotation (such as the Foo class in this case), not to the boilerplate
to attach it to the proper object. The boilerplate would go away from my
code, you could use the facility too without thought, and we'd all be
What do people think?
Zope3-dev mailing list