[Dev] Potential Problem in Notification Manager
Stuart Parmenter
pavlov at osafoundation.org
Tue Apr 13 14:45:59 PDT 2004
I used to have a try/catch there, however I removed it because I wanted
to see when exceptions got caught. I should have put some comments
there about that. I'll be making the notificaitons get fired
asynchronously shortly so this won't really be much of an issue.
thanks,
stuart
Andrew Francis wrote:
> Hello:
>
> I was looking at the Notification Manager, rev 1.16.
> I believe the following lines in the
> PostNotification() method are problematic:
>
>
>>for sub in subscribers:
>> sub.post(notification)
>
>
> and for context, code from the Subscription class:
>
>
>>def post(self, notification):
>> if notification.threadid != None:
>> if notification.threadid != self.threadid:
>> return
>> self.callback(notification)
>
>
> Unless I am missing something, the problem is that
> the sub.post() is not enclosed in a try block. If
> a callback generates an exception, the least of one's
> problems will be that the notification in question
> will not delivered to some of the subscribers. This
> is not good.
>
> One possible solution could be:
>
>
>>for sub in subscribers:
>> try:
>> sub.post(notification)
>> except:
>> # place logging information here.
>
>
> Cheers,
> Andrew
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online by April 15th
> http://taxes.yahoo.com/filing.html
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> Open Source Applications Foundation "Dev" mailing list
> http://lists.osafoundation.org/mailman/listinfo/dev
More information about the Dev
mailing list