changeset ea37edb11459 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=ea37edb11459
description:
        Load payload using the JSONDecoder

        The payload is dumped using the JSONEncoder so it should be loaded 
using the
        proper decoder.

        issue8024
        review56551002
diffstat:

 trytond/bus.py |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r b06cf1bb361c -r ea37edb11459 trytond/bus.py
--- a/trytond/bus.py    Wed Jan 30 10:00:49 2019 +0100
+++ b/trytond/bus.py    Wed Jan 30 10:02:36 2019 +0100
@@ -21,7 +21,7 @@
 from trytond import backend
 from trytond.wsgi import app
 from trytond.transaction import Transaction
-from trytond.protocols.jsonrpc import JSONEncoder
+from trytond.protocols.jsonrpc import JSONEncoder, JSONDecoder
 from trytond.config import config
 from trytond.tools import resolve
 
@@ -162,7 +162,9 @@
                 conn.poll()
                 while conn.notifies:
                     notification = conn.notifies.pop()
-                    payload = json.loads(notification.payload)
+                    payload = json.loads(
+                        notification.payload,
+                        object_hook=JSONDecoder())
                     channel = payload['channel']
                     message = payload['message']
                     messages.append(channel, message)

Reply via email to