Introspect data from Python missing return parameters
John (J5) Palmieri
johnp at redhat.com
Thu Oct 6 14:45:18 PDT 2005
In Python you can't know what will be returned if anything. Sanity
checking returns I feel is the job of the caller. If anything I would
just assume return a v which you wouldn't be able to sanity check
anyway.
On Thu, 2005-10-06 at 20:14 +0100, Daniel P. Berrange wrote:
> I've been doing some interoperability testing of the Perl bindings, and
> noticed a problem with the introspection data returned by Python services.
> While it provides information about the input parameters on methods, it
> omits information about the return parameters. Taking the 'example-service.py'
> program, it returns
>
> <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
> "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
> <node name="/SomeObject">
> <interface name="org.freedesktop.DBus.Introspectable">
> <method name="Introspect">
> </method>
> </interface>
> <interface name="org.designfu.SampleInterface">
> <method name="GetDict">
> </method>
> <method name="HelloWorld">
> <arg name="hello_message" type="v" />
> </method>
> <method name="GetTuple">
> </method>
> </interface>
> </node>
>
> Which is basically saying all its methods have no return value. In the Perl
> bindings I had assumed that introspection data is basically complete, or
> absent altogether. If present, I use the introspection data for return types
> to sanity the method reply contents. Hence with the return types missing,
> the sanity checks abort the caller.
>
> I expect to receive something closer to:
>
> <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
> "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
> <node name="/SomeObject">
> <interface name="org.freedesktop.DBus.Introspectable">
> <method name="Introspect">
> <arg type="s" direction="out"/>
> </method>
> </interface>
> <interface name="org.designfu.SampleInterface">
> <method name="GetDict">
> <arg type="a{ss}" direction="out"/>
> </method>
> <method name="GetTuple">
> <arg type="(ss)" direction="out"/>
> </method>
> <method name="HelloWorld">
> <arg type="s" direction="in"/>
> <arg type="as" direction="out"/>
> </method>
> </interface>
> </node>
>
>
> For weakly typed languages this isn't really too critical whether the
> return types are there or not, but strongly typed languages which
> use introspection data to auto generate API bindings would be handicapped.
> Thus I think it would be useful to fill out the spec on introspection
> to make it explicit about the semantics of the data provided.
>
> * Is it compulsory to list all interfaces ?
> * Is it compulsory to list all methods/signals within an interface ?
> * Is it compulsory to list all parameters/return types for a method ?
>
> Personally I'd like the answer to be yes for all of those questions,
> since it makes it possible to sanity check usage in the client code
> to provide explicit & informative error messages to the programmer.
>
> Regards,
> Dan.
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
--
More information about the dbus
mailing list