From: Frederic PAUT Date: Mon, 10 Jun 2013 12:40:50 +0000 (+0200) Subject: dbus service : Fix JSON encoding for allowing encoding of byte not utf-8 X-Git-Tag: upstream/0.6.1~43^2~1 X-Git-Url: http://review.tizen.org/git/?p=contrib%2Fcloudeebus.git;a=commitdiff_plain;h=a70e7ae32019dc3173d74ffcfae66f2a289f92da dbus service : Fix JSON encoding for allowing encoding of byte not utf-8 (and will be deliver in arguments for javascript functions) --- diff --git a/cloudeebus/cloudeebus.py b/cloudeebus/cloudeebus.py index 686c399..0982d02 100755 --- a/cloudeebus/cloudeebus.py +++ b/cloudeebus/cloudeebus.py @@ -571,7 +571,13 @@ class CloudeebusService: 'errorCB': async_error_cb} if methodId not in self.servicePendingCalls: self.servicePendingCalls[methodId] = {'count': 0, 'calls': []} - pendingCallStr = json.dumps({'callIndex': len(self.servicePendingCalls[methodId]['calls']), 'args': args}) + + try: + pendingCallStr = json.dumps({'callIndex': len(self.servicePendingCalls[methodId]['calls']), 'args': args}) + except Exception, e: + args = eval( str(args).replace("dbus.Byte", "dbus.Int16") ) + pendingCallStr = json.dumps({'callIndex': len(self.servicePendingCalls[methodId]['calls']), 'args': args}) + self.servicePendingCalls[methodId]['calls'].append(cb) self.servicePendingCalls[methodId]['count'] = self.servicePendingCalls[methodId]['count'] + 1 factory.dispatch(methodId, pendingCallStr)