added post-announce events

This commit is contained in:
Darren Ranalli 2004-11-25 04:10:04 +00:00
parent f428d0093a
commit 716f0f9c20

View File

@ -14,27 +14,31 @@ class BulletinBoard:
def __init__(self): def __init__(self):
self._dict = {} self._dict = {}
def get(self, name): def get(self, postName):
return self._dict.get(name) return self._dict.get(postName)
def has(self, name): def has(self, postName):
return name in self._dict return postName in self._dict
def post(self, name, value=None): def getEventName(self, postName):
if name in self._dict: return 'bboard-%s' % postName
def post(self, postName, value=None):
if postName in self._dict:
BulletinBoard.notify.warning('changing %s from %s to %s' % ( BulletinBoard.notify.warning('changing %s from %s to %s' % (
name, self._dict[name], value)) postName, self._dict[postName], value))
self.update(name, value) self.update(postName, value)
def update(self, name, value): def update(self, postName, value):
"""can use this to set value the first time""" """can use this to set value the first time"""
if name in self._dict: if postName in self._dict:
BulletinBoard.notify.info('update: posting %s' % (name)) BulletinBoard.notify.info('update: posting %s' % (postName))
self._dict[name] = value self._dict[postName] = value
messenger.send(self.getEventName(postName))
def remove(self, name):
if name in self._dict:
del self._dict[name]
def remove(self, postName):
if postName in self._dict:
del self._dict[postName]
def __repr__(self): def __repr__(self):
return str(self._dict) return str(self._dict)