dbus/python dbus.py,1.9,1.10 dbus_bindings.pyx.in,1.11,1.12

Seth Nickell seth at pdx.freedesktop.org
Sun Jul 11 23:29:02 PDT 2004


Update of /cvs/dbus/dbus/python
In directory pdx:/tmp/cvs-serv15886/python

Modified Files:
	dbus.py dbus_bindings.pyx.in 
Log Message:
2004-07-12  Seth Nickell  <seth at gnome.org>

	* python/dbus.py:

	Add message argument to the default object_method_handler
	function.
	
	* python/dbus_bindings.pyx.in:

	Automatically return NIL when passed an empty list
	(we can't pass back a list since lists are typed
	and we don't have any idea what type the the client
	intended the list to be... :-( )


Index: dbus.py
===================================================================
RCS file: /cvs/dbus/dbus/python/dbus.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dbus.py	11 Jul 2004 03:02:14 -0000	1.9
+++ dbus.py	12 Jul 2004 06:29:00 -0000	1.10
@@ -337,7 +337,7 @@
         message = dbus_bindings.Signal(object_path, interface, signal_name)
         self._connection.send(message)
         
-    def object_method_called(self, relative_path, method_name, argument_list):
+    def object_method_called(self, message, relative_path, method_name, argument_list):
         """Override this method. Called with, object_path, the relative path of the object
         under the base_path, the name of the method invoked, and a list of arguments
         """

Index: dbus_bindings.pyx.in
===================================================================
RCS file: /cvs/dbus/dbus/python/dbus_bindings.pyx.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dbus_bindings.pyx.in	8 Jun 2004 02:35:44 -0000	1.11
+++ dbus_bindings.pyx.in	12 Jul 2004 06:29:00 -0000	1.12
@@ -614,19 +614,23 @@
         elif value_type == dict:
             retval = self.append_dict(value)
         elif value_type == list:
-            if (len(value) == 0):
-                raise TypeError, "Empty lists are currently not supported, return None instead"
-            list_type = type(value[0])
-            if list_type == str:
-                self.append_string_array(value)
-            elif list_type == int:
-                self.append_int32_array(value)
-            elif list_type == float:
-                self.append_double_array(value)
-            elif isinstance(value[0], ObjectPath):
-                self.append_object_path_array(value)
+            if len(value) == 0:
+                # Empty lists are currently not supported, returning None instead
+                retval = self.append(None)
             else:
-                raise TypeError, "List of unknown type '%s'" % (list_type)
+                list_type = type(value[0])
+                if list_type == str:
+                    self.append_string_array(value)
+                elif list_type == int:
+                    self.append_int32_array(value)
+                elif list_type == float:
+                    self.append_double_array(value)
+                elif isinstance(value[0], ObjectPath):
+                    self.append_object_path_array(value)
+                else:
+                    raise TypeError, "List of unknown type '%s'" % (list_type)
+        elif value_type == None.__class__:
+            retval = self.append_nil()
         elif isinstance(value, ObjectPath):
             retval = self.append_object_path(value)
         else:




More information about the dbus-commit mailing list