On Wednesday 16 July 2008, Fred Drake wrote:
> On Wed, Jul 16, 2008 at 10:26 AM, Stephan Richter
> <[EMAIL PROTECTED]> wrote:
> > I agree. I realized only later that those events are defined in the
> > zope.app.container package. In this case I would just create new
> > annotation-specific events based on ObjectEvent, which is defined in
> > zope.component, and zope.component is already a dependency.
> Hmm.  Would these be fired by the IAnnotations adapter or by the
> factory?  There might be some interesting tradeoffs there.  Many
> annotations are just simple data types (strings, tuples,
> dictionaries); those can be used with object events, but it seems a
> little non-intuitive.

I do not think that I have a single annotation that is a simple type. I cannot 
even think of a quick example where any of the Zope 3 core packages have/use 
simple type annotations.

But I agree. The system supports simple type and that is one of the use cases. 
While I originally wanted to add at least 2 of the events to the IAnnotations 
adapter itself, I agree with you that the overhead penalty might be too 

With this in mind, I am modifying my proposal to add 2 event notifications to 
the factory only to produce a function like this (it is the result of calling 
the annotation factory):

def myFactory(context):
    key = '...'
    annotations = zope.annotation.interfaces.IAnnotations(context)
        result = annotations[key]
    except KeyError:
        result = Approval()
        annotations[key] = result
    located_result = zope.location.location.located(result, context, key)
    return located_result

I am torn whether the created event should be a annotation specific or not, 
because an object is not an annotation until it has been added as one.

Stephan Richter
Web Software Design, Development and Training
Google me. "Zope Stephan Richter"
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to