[wxPython-users] Bug in lib.pubsub?
Robin Dunn
robin at alldunn.com
Wed Jun 7 15:13:16 PDT 2006
Michael Hipp wrote:
> If I attempt to send a message using a topic for which noone has subscribed, I get this error:
>
> ---------------
> NameError: global name 'aTopic' is not defined
>
> Traceback (innermost last):
> [snip]
> File "c:\projects\common\pubsub.py", line 761, in sendMessage
> self.__deliveryCount += \
> File "c:\projects\common\pubsub.py", line 477, in sendMessage
> onTopicNeverCreated(aTopic)
> ---------------
>
> The code section is this:
>
> def sendMessage(self, topic, message, onTopicNeverCreated):
> """Send a message for given topic to all registered listeners. If
> topic doesn't exist, call onTopicNeverCreated(topic)."""
> # send to the all-toipcs listeners
> deliveryCount = _TopicTreeNode.sendMessage(self, message)
> # send to those who listen to given topic or any of its supertopics
> node = self
> for topicItem in topic:
> assert topicItem != ''
> if node.hasSubtopic(topicItem):
> node = node.getNode(topicItem)
> deliveryCount += node.sendMessage(message)
> else: # topic never created, don't bother continuing
> if onTopicNeverCreated is not None:
> onTopicNeverCreated(aTopic)
> break
> return deliveryCount
>
> Appears that 3rd-to-last line should be:
> onTopicNeverCreated(topicItem)
I've already received a patch correcting this, which changes aTopic -->
topic.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list