[Twisted-Python] Event dispatcher

Simon Pickles sipickles at hotmail.com
Tue Apr 1 06:31:54 EDT 2008

Ralph Meijer wrote:
> On Tue, 2008-04-01 at 09:12 +0200, Gabriel Rossetti wrote:
>> Gabriel Rossetti wrote:
>>> Hello,
>>> I was searching for an event dispatching mechanism in twisted and I 
>>> cam upon this :
>>> http://twistedmatrix.com/trac/browser/trunk/twisted/python/dispatch.py
>>> but apparently it's being depreciated. There is no mention of what 
>>> replaces it though, does someone know? Is there no replacement? If so, 
>>> that must mean that there is a better way of doing things, can someone 
>>> please tell me how?
> There is also an event dispatcher in twisted.words.xish.utility that
> might be useful.

I'm using twisted.words.xish.utility.EventDispatcher. Really easy, once 
I got the syntax right (to ignore all the xpath stuff):

ed = EventDispatcher()
ed.addObserver("//event/objectEvent", callbackFunc)

ed.dispatch("event message", "//event/objectEvent")

ed.removeObserver("//event/objectEvent", callbackFunc)


Linux Counter: User# 424693 

More information about the Twisted-Python mailing list