From d9c1aab77a68e85f8eed159147b66f3a31de8be7 Mon Sep 17 00:00:00 2001 From: TaykYoku Date: Sun, 3 Oct 2021 12:21:34 +0200 Subject: [PATCH] fix: handle request without argument --- .../WebApp/handler/SpaceOccupancyHandler.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/WebAppDIRAC/WebApp/handler/SpaceOccupancyHandler.py b/src/WebAppDIRAC/WebApp/handler/SpaceOccupancyHandler.py index 65ebd5778..9fb21a44c 100644 --- a/src/WebAppDIRAC/WebApp/handler/SpaceOccupancyHandler.py +++ b/src/WebAppDIRAC/WebApp/handler/SpaceOccupancyHandler.py @@ -40,7 +40,9 @@ def web_getSpaceOccupancyData(self): rmc = ResourceManagementClient() - res = yield self.threadTask(rmc.selectSpaceTokenOccupancyCache, None, self.__requestParams()) + se = json.loads(self.get_argument("StorageElement", "null")) + + res = yield self.threadTask(rmc.selectSpaceTokenOccupancyCache, None, list(se) if se else se) if not res['OK']: raise WErr.fromSERROR(res) @@ -81,11 +83,3 @@ def web_getSpaceOccupancyData(self): resList.append(spRes) self.finish({'success': "true", 'result': resList, 'total': len(res['Value'])}) - - def __requestParams(self): - ''' - We receive the request and we parse it, in this case, we are doing nothing, - but it can be certainly more complex. - ''' - gLogger.debug("!!! PARAMS: ", repr(self.request.arguments)) - return list(json.loads(self.get_argument("StorageElement", "null")))