[Zope-PTK] Re: [PTK(94)[1] request] Changing document views hard
Martijn Pieters
mj@digicool.com
Sun, 11 Jun 2000 20:40:06 +0200
On Sun, Jun 11, 2000 at 03:28:01PM -0400, Tres Seaver wrote:
> > Either, the code unregistering should expect an exception, or the
> > unregistering code should catch it and not let it pass on.
>
> Good point! I don't mind having unregisterObserver() throw, but I
> don't want to set up a race condition in the bozo-removal. How about
> this patch:
>
> for bozo in bozos:
> - self._observers.remove( bozo )
> + try: # avoid race condition if unregister() called before now
> + self._observers.remove( bozo )
> + except:
> + pass
Yup, that's what I had in mind. r=mj, as the Moz crows would say.
--
Martijn Pieters
| Software Engineer mailto:mj@digicool.com
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
| The Open Source Web Application Server
---------------------------------------------