comparison src/bridge/bridge_constructor/dbus_frontend_template.py @ 587:952322b1d490

Remove trailing whitespaces.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 18 Jan 2013 17:55:34 +0100
parents ca13633d3b6b
children 1f160467f5de
comparison
equal deleted inserted replaced
586:6a718ede8be1 587:952322b1d490
71 # We first check if we have an async call. We detect this in two ways: 71 # We first check if we have an async call. We detect this in two ways:
72 # - if we have the 'callback' and 'errback' keyword arguments 72 # - if we have the 'callback' and 'errback' keyword arguments
73 # - or if the last two arguments are callable 73 # - or if the last two arguments are callable
74 74
75 async = False 75 async = False
76 76
77 if kwargs: 77 if kwargs:
78 if 'callback' in kwargs and 'errback' in kwargs: 78 if 'callback' in kwargs and 'errback' in kwargs:
79 async = True 79 async = True
80 _callback = kwargs.pop('callback') 80 _callback = kwargs.pop('callback')
81 _errback = kwargs.pop('errback') 81 _errback = kwargs.pop('errback')
82 elif len(args)>=2 and callable(args[-1]) and callable(args[-2]): 82 elif len(args)>=2 and callable(args[-1]) and callable(args[-2]):
83 async = True 83 async = True
84 args = list(args) 84 args = list(args)
85 _errback = args.pop() 85 _errback = args.pop()
86 _callback = args.pop() 86 _callback = args.pop()
87 87
88 method = getattr(self.db_plugin_iface, name) 88 method = getattr(self.db_plugin_iface, name)
89 89
90 if async: 90 if async:
91 kwargs['reply_handler'] = _callback 91 kwargs['reply_handler'] = _callback
92 kwargs['error_handler'] = lambda err:_errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]) 92 kwargs['error_handler'] = lambda err:_errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])
93 93
94 return method(*args, **kwargs) 94 return method(*args, **kwargs)
95 95
96 return getPluginMethod 96 return getPluginMethod
97 97
98 ##METHODS_PART## 98 ##METHODS_PART##
99 99
100 #methods from plugins 100 #methods from plugins
101 101
102 def joinMUC(self, room_jid, nick, options, profile_key): 102 def joinMUC(self, room_jid, nick, options, profile_key):
103 if options == None: 103 if options == None:
104 options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature 104 options = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
105 return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key) 105 return self.db_plugin_iface.joinMUC(room_jid, nick, options, profile_key)
106 106
107 def gatewayRegister(self, action, target, data, profile_key): 107 def gatewayRegister(self, action, target, data, profile_key):
108 if data == None: 108 if data == None:
109 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature 109 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
110 return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key) 110 return self.db_plugin_iface.gatewayRegister(action, target, data, profile_key)