summaryrefslogtreecommitdiffstats
path: root/python/decorators.py
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2005-11-14 02:53:30 +0000
committerRobert McQueen <robot101@debian.org>2005-11-14 02:53:30 +0000
commit7b9236f2aef06b203acc019592cd102672427633 (patch)
tree7370bbcddbdefee3d24338b0142c3fcb8e7b0b1e /python/decorators.py
parent45ef0fbc4f0f5441425484be3662b2c44d2554b3 (diff)
2005-11-14 Robert McQueen <robot101@debian.org>
* python/decorators.py, python/service.py: Add a new argument to the dbus.service.method decorator called sender_keyword, which if set, specifies the name of an argument which will be provided the bus name of the method caller. * test/python/test-client.py, test/python/test-service.py: Add a method and test to check the sender_keyword functionality.
Diffstat (limited to 'python/decorators.py')
-rw-r--r--python/decorators.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/decorators.py b/python/decorators.py
index e4cc0249..c9bc17fa 100644
--- a/python/decorators.py
+++ b/python/decorators.py
@@ -2,7 +2,7 @@ import _util
import inspect
import dbus_bindings
-def method(dbus_interface, in_signature=None, out_signature=None, async_callbacks=None):
+def method(dbus_interface, in_signature=None, out_signature=None, async_callbacks=None, sender_keyword=None):
_util._validate_interface_or_name(dbus_interface)
def decorator(func):
@@ -17,6 +17,9 @@ def method(dbus_interface, in_signature=None, out_signature=None, async_callback
args.remove(async_callbacks[0])
args.remove(async_callbacks[1])
+ if sender_keyword:
+ args.remove(sender_keyword)
+
if in_signature:
in_sig = tuple(dbus_bindings.Signature(in_signature))
@@ -30,6 +33,7 @@ def method(dbus_interface, in_signature=None, out_signature=None, async_callback
func._dbus_interface = dbus_interface
func._dbus_in_signature = in_signature
func._dbus_out_signature = out_signature
+ func._dbus_sender_keyword = sender_keyword
func._dbus_args = args
return func