diff options
author | Robert McQueen <robot101@debian.org> | 2005-11-07 15:31:30 +0000 |
---|---|---|
committer | Robert McQueen <robot101@debian.org> | 2005-11-07 15:31:30 +0000 |
commit | e598c5edc5b4d3fa7eb474ab3cd93ec6747e4bc0 (patch) | |
tree | b6769252aea4e581aef2261fcdd1ceebd321b8fc /python/decorators.py | |
parent | 95f9771d6be677d3393aab60f0f56126fbb252a6 (diff) |
2005-11-07 Robert McQueen <robot101@debian.org>
* python/decorators.py: Change emit_signal function to use the
signature annotation of the signal when marhsalling the arguments from
the service. Fix a bug where the code checking signature length
against argument length referenced the wrong variable.
* python/introspect_parser.py: Avoid adding the type signature of
signal arguments to any methods which occur after them in the
introspection data (!) by making the parser a little more careful
about its current state.
* python/service.py: Remove debug prints from last commit (again :D).
* test/python/test-client.py, test/python/test-service.py: Add test
signals with signature decorators to test the strict marshalling code
gives errors at the right time. Could do with checking the signals
actually get emitted too, given that the test does nothing with
signals at the moment...
Diffstat (limited to 'python/decorators.py')
-rw-r--r-- | python/decorators.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/python/decorators.py b/python/decorators.py index 3973f3e4..e4cc0249 100644 --- a/python/decorators.py +++ b/python/decorators.py @@ -39,20 +39,25 @@ def signal(dbus_interface, signature=None): _util._validate_interface_or_name(dbus_interface) def decorator(func): def emit_signal(self, *args, **keywords): - func(self, *args, **keywords) + func(self, *args, **keywords) message = dbus_bindings.Signal(self._object_path, dbus_interface, func.__name__) iter = message.get_iter(True) - - for arg in args: - iter.append(arg) - + + if emit_signal._dbus_signature: + signature = tuple(dbus_bindings.Signature(emit_signal._dbus_signature)) + for (arg, sig) in zip(args, signature): + iter.append_strict(arg, sig) + else: + for arg in args: + iter.append(arg) + self._connection.send(message) args = inspect.getargspec(func)[0] args.pop(0) if signature: - sig = tuple(dbus_bindings.Signature(func._dbus_signature)) + sig = tuple(dbus_bindings.Signature(signature)) if len(sig) > len(args): raise ValueError, 'signal signature is longer than the number of arguments provided' |