Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

once can't remove handler #1

Closed
Quard opened this issue Jul 20, 2011 · 3 comments
Closed

once can't remove handler #1

Quard opened this issue Jul 20, 2011 · 3 comments

Comments

@Quard
Copy link

Quard commented Jul 20, 2011

Do not work removing handler from event after call

>>> from pyee import Event_emitter
>>> ee = Event_emitter()
>>> @ee.once('event1')
def e1_handler():
    print 'Event 1'

>>> ee.emit('event1')
Event 1
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    ee.emit('event1')
  File "/home/quard/src/pyee/pyee/__init__.py", line 37, in emit
    fxn(*args)
  File "/home/quard/src/pyee/pyee/__init__.py", line 43, in g
    self.remove(self,event)
AttributeError: 'Event_emitter' object has no attribute 'remove'
@jfhbrook
Copy link
Owner

Hmm, I see! Very interesting. I thought I tested that!

I'll see if I can fix this today.

jfhbrook added a commit that referenced this issue Jul 21, 2011
@jfhbrook
Copy link
Owner

Luckily, it seems like a pretty obvious bug, as I was calling .remove instead of .remove_listener. This bug seems fixed in v0.0.2.

The more interesting bug seems to be that the test was passing despite the code obviously being wrong. This is posted as a separate issue.

Go ahead and try out v0.0.2 and let me know if it still fails, so that I may close this issue.

@jfhbrook
Copy link
Owner

Yet another update: Rewrote the tests, found some more bugs in .once. Should be fixed in v0.0.3, and verified in tests.

I feel pretty good about this one. If you still have issues, lemme know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants