From f6221a798a0b78f0aed38f2fdca1d89ed0598ba3 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 6 Mar 2019 02:23:01 +0100 Subject: [PATCH] Don't add disable_logging to the string representation of the Response object unless it's set --- platypush/message/response/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/platypush/message/response/__init__.py b/platypush/message/response/__init__.py index a73eebd050..7faa8c99cf 100644 --- a/platypush/message/response/__init__.py +++ b/platypush/message/response/__init__.py @@ -63,18 +63,22 @@ class Response(Message): the message into a UTF-8 JSON string """ - return json.dumps({ + response_dict = { 'id' : self.id, 'type' : 'response', 'target' : self.target if hasattr(self, 'target') else None, 'origin' : self.origin if hasattr(self, 'origin') else None, '_timestamp' : self.timestamp, - '_disable_logging' : self.disable_logging, 'response' : { 'output' : self.output, 'errors' : self.errors, }, - }) + } + + if self.disable_logging: + response_dict['_disable_logging'] = self.disable_logging + + return json.dumps(response_dict) # vim:sw=4:ts=4:et: