dbus/python _dbus.py,1.6,1.7 matchrules.py,1.2,1.3
John Palmieri
johnp at freedesktop.org
Fri Jul 15 12:15:10 EST 2005
Update of /cvs/dbus/dbus/python
In directory gabe:/tmp/cvs-serv19799/python
Modified Files:
_dbus.py matchrules.py
Log Message:
* 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
Index: _dbus.py
===================================================================
RCS file: /cvs/dbus/dbus/python/_dbus.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- _dbus.py 12 Jul 2005 18:16:06 -0000 1.6
+++ _dbus.py 15 Jul 2005 02:15:08 -0000 1.7
@@ -126,7 +126,9 @@
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)
Index: matchrules.py
===================================================================
RCS file: /cvs/dbus/dbus/python/matchrules.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- matchrules.py 24 May 2005 16:30:50 -0000 1.2
+++ matchrules.py 15 Jul 2005 02:15:08 -0000 1.3
@@ -52,7 +52,7 @@
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 @@
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
More information about the dbus-commit
mailing list