Jim Fulton wrote: >> All 4 lines of it? ;) >> >> subscribers = [] >> >> def notify(event): >> for subscriber in subscribers: >> subscriber(event) >> >> Seriously, though, this handles the notification but not the state >> machine, which I think is critical to the effort. It also doesn't >> do any >> error-handling for misbehaving subscribers, so not all subscribers are >> guaranteed to run if there's an unhandled error in an earlier >> subscriber. It also sends all events to all subscribers, instead of >> partitioning the subscribers. > > Right. You need a dispatching layer behind this. The beauty of > zope.event is that it puts very little requirement on people who > publish events.
The problem is that it relies on some specific dispatching layer, and that layer would *also* have to be defined to use this for something useful like the start/stop events that are motivating this discussion. That is, if you dispatch on "isinstance(event, tuple) and event and event[0] == 'some_name'", that's very different than "isinstance(event, SomeClass)" or "implements(event, ISomething)" or whatever. Actual servers have to emit something more specific than just "an object". -- Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org | Write code, do good | http://topp.openplans.org/careers _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com