From e9e8b5314e6129099f0129d262ea9959aacbdfa4 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Tue, 2 Apr 2013 17:10:43 -0700 Subject: Explain why the give methods are whitelisted. In order to aid mine (and likely others) understanding of this code it seems to make sense to document what these special whitelisted attributes are. Change-Id: I1c11484fc74e898df5d25ab94ed0cdb288accd67 --- nova/api/openstack/wsgi.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 91eeef4b1..03674d767 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -60,6 +60,15 @@ _MEDIA_TYPE_MAP = { 'application/atom+xml': 'atom', } +# These are typically automatically created by routes as either defaults +# collection or member methods. +_ROUTES_METHODS = [ + 'create', + 'delete', + 'show', + 'update', +] + class Request(webob.Request): """Add some OpenStack API-specific logic to the base webob.Request.""" @@ -998,8 +1007,7 @@ class Resource(wsgi.Application): meth = getattr(self.controller, action) except AttributeError: if (not self.wsgi_actions or - action not in ['action', 'create', 'delete', 'update', - 'show']): + action not in _ROUTES_METHODS + ['action']): # Propagate the error raise else: -- cgit