hgrecco/pizco — pull request #12 by braingram (2014-04-21 01:40:49+00:00)
Title: New Signal Class & Agent.notifications_callback unsubscribe bugfix

I've added a new Signal class that takes a spec on creation and verifies that attached callbacks meet the spec on connect. Emit args are also checked against the spec prior to calling the callbacks. Also added a SignalError class that is raised when any of the above checks fail.

This required a bit of code modification as Signals need to be handled specially by the proxy. One possible way to get around needed to modify code code for this situation (and other possible special objects). Might be to look for a particular attribute in a handled object (maybe __pizcoify__) which would indicate to the proxy that this object requires special treatment. I'll make a separate issue where this can be discussed.

I also added a bugfix to Agent.notications_callbacks. Sometimes when the tests were run (maybe 1/5 times). I would get an error:

> File "pizco/pizco/agent.py", line 372, in _on_notification
> callback = self.notifications_callbacks[(sender, topic)]
> KeyError: (u'tcp://127.0.0.1:6008', u'rw_prop_changed')

I tracked this down to unsubscribe removing the callback, queuing up _unsubscribe inside the ioloop, but the loop first responding to an incoming message and trying to call a non-existent callback. Now, the default callback will be called.