- repair bool() for instance level event listener where events are classlevel, continuing [ticket:2516]

This commit is contained in:
Mike Bayer
2012-09-20 12:03:24 -04:00
parent 9e3458c479
commit e5accce97b
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -352,7 +352,7 @@ class _EmptyListener(object):
return iter(self.parent_listeners)
def __nonzero__(self):
return False
return bool(self.parent_listeners)
class _CompoundListener(object):
_exec_once = False
+7
View File
@@ -50,6 +50,13 @@ class EventsTest(fixtures.TestBase):
eq_(len(self.Target().dispatch.event_two), 0)
eq_(len(t1.dispatch.event_two), 0)
def test_bool_clslevel(self):
def listen_one(x, y):
pass
event.listen(self.Target, "event_one", listen_one)
t = self.Target()
assert t.dispatch.event_one
def test_register_class_instance(self):
def listen_one(x, y):
pass