[Chandler-dev] Observers and stamps
Brian Kirsch
bkirsch at osafoundation.org
Wed Nov 29 11:15:07 PST 2006
Hi Jeffrey,
See comments inline.
-Brian
On Nov 28, 2006, at 3:53 PM, Jeffrey Harris wrote:
> Hi Folks,
>
> I have code in EventStamp (on the recurrence branch) that says:
>
> @schema.observer(ContentItem.collections)
> def onCollectionChange(self, op, name):
> ...
>
> I just realized that this observer gets called every time an item is
> added to (or removed from) a collection, not just when EventStamps are
> added to collections, because it's watching an attribute that doesn't
> live on EventStamp.
>
To implement the new In / Out collection logic I have added observers
on MailStamp itself to detect changes in the fromAddress, toAddress,
etc.
> I think for my use cases, I'd be happy to have observers on stamps
> only
> get called if the item in question has that stamp. Do other folks
> have
> use cases where they want observers to apply to all items,
> regardless of
> stamp?
No
> Would it be reasonable for those observers to always live on
> ContentItem?
> If so, it seems like we could save ourselves a bit of method
> calling by
> checking stamps before calling observers. I'm not sure that
> that'll buy
> us all that much, method calls aren't all that expensive, but it would
> be interesting to see if it buys us anything. It also seems
> conceptually cleaner to me.
+1
I could see having stamping detection for observer callbacks as a
very valuable feature although I do not have a specific need for it
at this time.
>
> Thoughts?
>
> Sincerely,
> Jeffrey
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> Open Source Applications Foundation "chandler-dev" mailing list
> http://lists.osafoundation.org/mailman/listinfo/chandler-dev
More information about the chandler-dev
mailing list