dbus/python dbus_bindings.pyx,1.9,1.10 service.py,1.9,1.10

John Palmieri johnp at freedesktop.org
Fri Oct 14 14:44:02 PDT 2005


Update of /cvs/dbus/dbus/python
In directory gabe:/tmp/cvs-serv10698/python

Modified Files:
	dbus_bindings.pyx service.py 
Log Message:
* python/dbus_bindings.pyx (MessageIter::append_strict): check for
  STRUCT_BEGIN not TYPE_STRUCT in indicate we are marshalling a struct

* python/service.py (Object::_message_cb): handle exceptions correctly
  by sending them over the wire to the calling app.  This makes sure
  the client returns immediately instead of waiting the 15 seconds to
  timeout.

* test/python/test-client.py (TestDBusBindings::testBenchmarkIntrospect): 
  Add a test to benchmark how long it takes to introspect a service and 
  call a method which returns a large element (pretty fast)

* test/python/test-service.py (TestObject::GetComplexArray): new test 
  method which pushes a lot of data


Index: dbus_bindings.pyx
===================================================================
RCS file: /cvs/dbus/dbus/python/dbus_bindings.pyx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- dbus_bindings.pyx	5 Oct 2005 20:43:46 -0000	1.9
+++ dbus_bindings.pyx	14 Oct 2005 21:44:00 -0000	1.10
@@ -978,7 +978,6 @@
         return (sig, remainder)
   
     def append_strict(self, value, sig):
-        
     
         if sig == TYPE_INVALID or sig == None:
             raise TypeError, 'Invalid arg type sent to append_strict'
@@ -1023,7 +1022,7 @@
                 retval = self.append_array(Array(value, signature=tmp_sig))
         elif sig_type == TYPE_OBJECT_PATH:
             retval = self.append_object_path(value)
-        elif sig_type == TYPE_STRUCT:
+        elif sig_type == STRUCT_BEGIN:
             tmp_sig = sig[1:-1]
             retval = self.append_struct(value, signature = tmp_sig)
         elif sig_type == TYPE_VARIANT:

Index: service.py
===================================================================
RCS file: /cvs/dbus/dbus/python/service.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- service.py	13 Oct 2005 23:34:12 -0000	1.9
+++ service.py	14 Oct 2005 21:44:00 -0000	1.10
@@ -168,13 +168,19 @@
         print ("Unregister")
 
     def _message_cb(self, connection, message):
-        target_method_name = message.get_member()
-        target_methods = self._dbus_method_vtable[target_method_name]
-        args = message.get_args_list()
+        try:
+            target_method_name = message.get_member()
+            target_methods = self._dbus_method_vtable[target_method_name]
+            args = message.get_args_list()
         
-        reply = _dispatch_dbus_method_call(target_methods, self, args, message)
+            reply = _dispatch_dbus_method_call(target_methods, self, args, message)
 
-        self._connection.send(reply)
+            self._connection.send(reply)
+        except Exception, e:
+            error_reply = dbus_bindings.Error(message, 
+	                                      "org.freedesktop.DBus.Python.%s" % e.__class__.__name__, 
+                                              str(e))
+            self._connection.send(error_reply)
 
     @method('org.freedesktop.DBus.Introspectable')
     def Introspect(self):



More information about the dbus-commit mailing list