mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
made OneShotObserverList a new-style class
This commit is contained in:
parent
c8f11dc2d3
commit
4c2f0db5d2
@ -10,7 +10,7 @@ something happens. The way this is typically implemented is that the observed
|
||||
has an ObserverList whose when_fired method is called in the observed's
|
||||
'when_something'."""
|
||||
|
||||
class OneShotObserverList:
|
||||
class OneShotObserverList(object):
|
||||
"""A one-shot event distributor."""
|
||||
def __init__(self):
|
||||
self._fired = False
|
||||
@ -18,6 +18,12 @@ class OneShotObserverList:
|
||||
self._watchers = []
|
||||
self.__repr__ = self._unfired_repr
|
||||
|
||||
def __repr__(self):
|
||||
"""string representation of the OneshotObserverList"""
|
||||
if self._fired:
|
||||
return self._fired_repr()
|
||||
return self._unfired_repr()
|
||||
|
||||
def _unfired_repr(self):
|
||||
return "<OneShotObserverList [%s]>" % (self._watchers, )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user