<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.10.1">
</HEAD>
<BODY>
On Thu, 2006-06-01 at 12:27 +0200, Florent Guillaume wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">Thierry FLORAC wrote:</FONT>
<FONT COLOR="#000000">> I've build a simple adapter that modifies context properties through</FONT>
<FONT COLOR="#000000">> annotations ; everything works fine.</FONT>
<FONT COLOR="#000000">> In several cases, when some attributes are updated, I do a</FONT>
<FONT COLOR="#000000">> "notify(ObjectModifiedEvent(self.context))" so that several subscribers</FONT>
<FONT COLOR="#000000">> are called.</FONT>
<FONT COLOR="#000000">> </FONT>
<FONT COLOR="#000000">> My problem is then that if several attributes modifications are done,</FONT>
<FONT COLOR="#000000">> several "ObjectModifiedEvent" are sent and the same handler is called</FONT>
<FONT COLOR="#000000">> several times (with the same parameters) ; so is it easily possible to</FONT>
<FONT COLOR="#000000">> prevent the same event to be called several times for a same context and</FONT>
<FONT COLOR="#000000">> a same request ?</FONT>
<FONT COLOR="#000000">> Or should I try to use request annotations and subscribe to</FONT>
<FONT COLOR="#000000">> IEndRequestEvent (if it's not too late and not too expensive...) ?</FONT>
<FONT COLOR="#000000">Yes that's the proper way to do compress events: record the stuff to do, and </FONT>
<FONT COLOR="#000000">do it at the end of the request.</FONT>
<FONT COLOR="#000000">Depending on the stuff to do, it may involve subtleties, for instance if you </FONT>
<FONT COLOR="#000000">modify one object then delete it in the same request, you don't want to call </FONT>
<FONT COLOR="#000000">your final handler for that object...</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
Thanks for the reply, but I'd like to have a few complements :<BR>
- I suppose that IEndRequestEvent is sent automatically for every request, so even for consultation requests which doesn't imply any modification. So I suppose that the IEndRequestEvent handler have to be VERY optimised if I don't want it to be too expensive.<BR>
- what is the best way to keep track of objects having been modified (and which, for example, should be re-indexed) into request annotations. Can I just put an object into an annotation's list (with a kind of "IAnnotations(request)['myKey'].append(context)") ??<BR>
<BR>
Thanks,<BR>
Thierry<BR>
<BR>
</BODY>
<br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</HTML>