From fb14edb01dc7171f7053b57aedb64abcc975659c Mon Sep 17 00:00:00 2001 From: Leo Tomatsu Date: Tue, 8 Aug 2017 19:24:46 +0000 Subject: [PATCH] RequestHandler refactor Split out RequestHandler.__init__ into multiple functions Change-Id: I43925868044d32b665d401c53a284a803f726c8a --- mixmatch/proxy.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mixmatch/proxy.py b/mixmatch/proxy.py index 0c5b09b..2c85213 100644 --- a/mixmatch/proxy.py +++ b/mixmatch/proxy.py @@ -107,10 +107,21 @@ class RequestHandler(object): service_providers.get(CONF, sp).enabled_services), CONF.service_providers ) + self.mapping = None + self._handle_extension() + + self._handle_action() + + self._handle_sp_project() + + self._log_request_to_proxy() + + def _handle_extension(self): for extension in self.extensions: extension.handle_request(self.details) + def _handle_action(self): if not self.details['version']: if CONF.aggregation: # unversioned calls with no action @@ -123,6 +134,7 @@ class RequestHandler(object): # versioned calls with no action abort(400) + def _handle_sp_project(self): mapping = None if self.details['resource_id']: @@ -155,6 +167,7 @@ class RequestHandler(object): else: self._forward = self._forward + def _log_request_to_proxy(self): LOG.info(format_for_log(title="Request to proxy", method=self.details['method'], url=self.details['path'],