summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-07-15 02:15:08 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-07-15 02:15:08 +0000
commitdc4d80e56775c1a69a51f196aec1bd331a645749 (patch)
treee6fb5461986a216dc64a529004392f8a859472b6 /python
parent6c191520c8b33cd7e550a6e3d9d853c25f552f54 (diff)
* python/_dbus.py (Bus::remove_signal_receiver):
don't add a callback to the match if none has been passed in * python/matchrules.py (SignalMatchTree::remove): if the rule being matched does not have a callback treat it as a wildcard fix matching logic * doc/dbus-tutorial.xml: Add Python tutorial
Diffstat (limited to 'python')
-rw-r--r--python/_dbus.py4
-rw-r--r--python/matchrules.py12
2 files changed, 11 insertions, 5 deletions
diff --git a/python/_dbus.py b/python/_dbus.py
index d52aa8fc..652d27bd 100644
--- a/python/_dbus.py
+++ b/python/_dbus.py
@@ -126,7 +126,9 @@ class Bus:
named_service = bus_object.GetNameOwner(named_service, dbus_interface='org.freedesktop.DBus')
match_rule = SignalMatchRule(signal_name, dbus_interface, named_service, path)
- match_rule.add_handler(handler_function)
+
+ if (handler_function):
+ match_rule.add_handler(handler_function)
self._match_rule_tree.remove(match_rule)
diff --git a/python/matchrules.py b/python/matchrules.py
index 6d5fcd86..9a7edb3e 100644
--- a/python/matchrules.py
+++ b/python/matchrules.py
@@ -52,7 +52,7 @@ class SignalMatchNode:
def remove_child(self, child, key=None):
if self.wildcard == child:
self.wildcard = None
- elif self.finite.had_key(key):
+ elif self.finite.has_key(key):
del self.finite[key]
class SignalMatchTree:
@@ -139,11 +139,15 @@ class SignalMatchRule:
self.dbus_interface == rule.dbus_interface and
self.sender == rule.sender and
self.path == rule.path):
- _funcs_copy_a = self.dbus.handler_functions[0:]
- _funcs_copy_b = rule.dbus.handler_functions[0:]
+ if rule.handler_functions == []:
+ return True
+
+ _funcs_copy_a = self.handler_functions[0:]
+ _funcs_copy_b = rule.handler_functions[0:]
_funcs_copy_a.sort()
_funcs_copy_b.sort()
- return a == b
+
+ return _funcs_copy_a == _funcs_copy_b
return False