<!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">&gt; I've build a simple adapter that modifies context properties through</FONT>
<FONT COLOR="#000000">&gt; annotations ; everything works fine.</FONT>
<FONT COLOR="#000000">&gt; In several cases, when some attributes are updated, I do a</FONT>
<FONT COLOR="#000000">&gt; &quot;notify(ObjectModifiedEvent(self.context))&quot; so that several subscribers</FONT>
<FONT COLOR="#000000">&gt; are called.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; My problem is then that if several attributes modifications are done,</FONT>
<FONT COLOR="#000000">&gt; several &quot;ObjectModifiedEvent&quot; are sent and the same handler is called</FONT>
<FONT COLOR="#000000">&gt; several times (with the same parameters) ; so is it easily possible to</FONT>
<FONT COLOR="#000000">&gt; prevent the same event to be called several times for a same context and</FONT>
<FONT COLOR="#000000">&gt; a same request ?</FONT>
<FONT COLOR="#000000">&gt; Or should I try to use request annotations and subscribe to</FONT>
<FONT COLOR="#000000">&gt; 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 &quot;IAnnotations(request)['myKey'].append(context)&quot;) ??<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>