From 944cd04f4f15d0f52dd760ee36bc9462d427076f Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Mon, 10 Jul 2017 16:42:41 -0400 Subject: Allow json response plugin to be suppressed Add a static class member suppress_json_resp that when set to True will prevent the JsonApiResp plugin from responding with a json wrapper. Change-Id: I43aadb6b59bb21ef53e5252e4878157c8e13935e Signed-off-by: Brad Bishop --- module/obmc/wsgi/apps/rest_dbus.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/obmc/wsgi/apps/rest_dbus.py') diff --git a/module/obmc/wsgi/apps/rest_dbus.py b/module/obmc/wsgi/apps/rest_dbus.py index 43d1f03..8cbbabc 100644 --- a/module/obmc/wsgi/apps/rest_dbus.py +++ b/module/obmc/wsgi/apps/rest_dbus.py @@ -713,6 +713,7 @@ class DownloadDumpHandler(RouteHandler): content_type = 'application/octet-stream' ''' TODO openbmc/issues #1795, Change dump path''' dump_loc = '/tmp/dumps' + suppress_json_resp = True def __init__(self, app, bus): super(DownloadDumpHandler, self).__init__( @@ -934,9 +935,9 @@ class JsonApiResponsePlugin(object): app.install_error_callback(self.error_callback) def apply(self, callback, route): - content_type = getattr( - route.get_undecorated_callback(), '_content_type', None) - if self.json_type != content_type: + skip = getattr( + route.get_undecorated_callback(), 'suppress_json_resp', None) + if skip: return callback def wrap(*a, **kw): -- cgit v1.2.1