Notifications

Every good framework needs a library in the !Subject/Observer pattern, and this is ours. Expect this code to undergo some transition in the next few releases. It is currently a very extensible engine, but not simple to configure. We hope to change the latter "soon". Right now, we'll just link you to the code...

Code

Example

Usually, subject and observer and no so close together, but to give you the flavor of the library::

from TG.notifications import events

def anObserver(a, b=None, c='Default C'):
    print "anObserver(a=%r, b=%r, c=%r)" % (a,b,c)

myEvent = events.Event()
myEvent.add(anObserver)

myEvent(42)
# anObserver(a=42, b=None, c='Default C')
myEvent(42, "B is a good argument!", c=10+5j)
# anObserver(a=42, b='B is a good argument!', c=(10+5j))