Load payload using the JSONDecoder

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

issue8024
review56551002
This commit is contained in:
Cédric Krier committed 2019-01-30 10:02:36 +01:00
1 parent 572372d3c8
commit b906d84d87
1 file changed
+4 -2
+4 -2
View File
@@ -21,7 +21,7 @@ from werkzeug.exceptions import NotImplemented, BadRequest
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 @@ class LongPollingBus:
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)