diff options
author | Michael Johnson <johnsomor@gmail.com> | 2022-07-21 21:14:56 +0000 |
---|---|---|
committer | Michael Johnson <johnsomor@gmail.com> | 2022-07-21 21:25:17 +0000 |
commit | e045483500bab538db29134c327c58ab8b8390d6 (patch) | |
tree | 1c58d0513096fdfd15adc72a97e6858afda147fd /designate/api | |
parent | 3423a3e6568c1755405d4dc31eed1121769eb7a2 (diff) | |
download | designate-e045483500bab538db29134c327c58ab8b8390d6.tar.gz |
Fix pecan lookup_controller DeprecationWarning
This patch updates Designate for the new funtion signature on pecan
lookup_controller to include the request information if available.
This corrects the following warning we were seeing in Designate:
DeprecationWarning: The function signature for pecan.routing.lookup_controller is changing in the next version of pecan.
Please update to: `lookup_controller(self, obj, remainder, request)`.
Change-Id: Icb206e59c83eec984599d48b3d4719c36eb83734
Diffstat (limited to 'designate/api')
-rw-r--r-- | designate/api/v2/controllers/rest.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/designate/api/v2/controllers/rest.py b/designate/api/v2/controllers/rest.py index e6de3593..7f6c2c92 100644 --- a/designate/api/v2/controllers/rest.py +++ b/designate/api/v2/controllers/rest.py @@ -62,7 +62,7 @@ class RestController(pecan.rest.RestController): else: return criterion - def _handle_post(self, method, remainder): + def _handle_post(self, method, remainder, request=None): ''' Routes ``POST`` actions to the appropriate controller. ''' @@ -75,7 +75,8 @@ class RestController(pecan.rest.RestController): controller = getattr(self, remainder[0], None) if controller and not inspect.ismethod(controller): - return pecan.routing.lookup_controller(controller, remainder[1:]) + return pecan.routing.lookup_controller(controller, remainder[1:], + request=request) # finally, check for the regular post_one/post requests controller = self._find_controller('post_one', 'post') @@ -84,7 +85,7 @@ class RestController(pecan.rest.RestController): pecan.abort(405) - def _handle_patch(self, method, remainder): + def _handle_patch(self, method, remainder, request=None): ''' Routes ``PATCH`` actions to the appropriate controller. ''' @@ -97,7 +98,8 @@ class RestController(pecan.rest.RestController): controller = getattr(self, remainder[0], None) if controller and not inspect.ismethod(controller): - return pecan.routing.lookup_controller(controller, remainder[1:]) + return pecan.routing.lookup_controller(controller, remainder[1:], + request=request) # finally, check for the regular patch_one/patch requests controller = self._find_controller('patch_one', 'patch') @@ -106,7 +108,7 @@ class RestController(pecan.rest.RestController): pecan.abort(405) - def _handle_put(self, method, remainder): + def _handle_put(self, method, remainder, request=None): ''' Routes ``PUT`` actions to the appropriate controller. ''' @@ -119,7 +121,8 @@ class RestController(pecan.rest.RestController): controller = getattr(self, remainder[0], None) if controller and not inspect.ismethod(controller): - return pecan.routing.lookup_controller(controller, remainder[1:]) + return pecan.routing.lookup_controller(controller, remainder[1:], + request=request) # finally, check for the regular put_one/put requests controller = self._find_controller('put_one', 'put') @@ -128,7 +131,7 @@ class RestController(pecan.rest.RestController): pecan.abort(405) - def _handle_delete(self, method, remainder): + def _handle_delete(self, method, remainder, request=None): ''' Routes ``DELETE`` actions to the appropriate controller. ''' @@ -141,7 +144,8 @@ class RestController(pecan.rest.RestController): controller = getattr(self, remainder[0], None) if controller and not inspect.ismethod(controller): - return pecan.routing.lookup_controller(controller, remainder[1:]) + return pecan.routing.lookup_controller(controller, remainder[1:], + request=request) # finally, check for the regular delete_one/delete requests controller = self._find_controller('delete_one', 'delete') |