Newer
Older
"""
Base class to provide functionality to notify updates to other objects
"""
def subscribe(self, who, callback=None):
"""
Add a suscriber to the current publisher
:param who: subscriber to add
:type who: object
:param callback: method to execute when publisher updates
if callback is None:
callback = getattr(who, 'update')
"""
Removes a suscriber from the current publisher
:param who: suscriber to remove
:type who: object
"""
"""
Notify update to all the suscribers
:param args: arguments to pass
"""
for subscriber, callback in self._subscribers.items():
def suscribers(self, *args):
"""
Notify update to all the suscribers
:param args: arguments to pass
"""
return self._subscribers.keys()