diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-09-23 14:01:46 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-09-23 14:01:46 -0400 |
commit | 70cd632270083acc2bb835069d6e00f07a728cb3 (patch) | |
tree | 37298ef15ceed88a147ec668ce6977a9f1a5b942 /pubsub.py | |
parent | f44c44324c24aa667bfd56bb7b9ee2e96ac93bd4 (diff) | |
download | python-termcast-server-70cd632270083acc2bb835069d6e00f07a728cb3.tar.gz python-termcast-server-70cd632270083acc2bb835069d6e00f07a728cb3.zip |
reorganize
Diffstat (limited to 'pubsub.py')
-rw-r--r-- | pubsub.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/pubsub.py b/pubsub.py deleted file mode 100644 index b5faf22..0000000 --- a/pubsub.py +++ /dev/null @@ -1,31 +0,0 @@ -class Publisher(object): - def __init__(self): - self.subscribers = [] - - def subscribe(self, who): - if who not in self.subscribers: - self.subscribers.append(who) - - def unsubscribe(self, who): - if who in self.subscribers: - self.subscribers.remove(who) - - def request_all(self, message, *args): - ret = [] - for subscriber in self.subscribers: - method = "request_" + message - if hasattr(subscriber, method): - ret.append(getattr(subscriber, method)(*args)) - return ret - - def request_one(self, message, *args): - for subscriber in self.subscribers: - method = "request_" + message - if hasattr(subscriber, method): - return getattr(subscriber, method)(*args) - - def notify(self, message, *args): - for subscriber in self.subscribers: - method = "msg_" + message - if hasattr(subscriber, method): - getattr(subscriber, method)(*args) |