[Dev] Potential Problem in Notification Manager
Andrew Francis
andrewfr_ice at yahoo.com
Sun Apr 11 13:24:38 PDT 2004
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
More information about the Dev
mailing list