summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorNaveed Massjouni <naveedm9@gmail.com>2011-03-15 18:10:25 -0400
committerNaveed Massjouni <naveedm9@gmail.com>2011-03-15 18:10:25 -0400
commit74068a7b504a95dc8e0339faa04c8c5520417f32 (patch)
tree7b21b915baff74cccba512ba8f85df318c56fd62 /nova/api
parentbe35a1ce58b30d5b20e542b24d66947454d20fc3 (diff)
Per Eric Day's suggest, the verson is not store in the request environ instead
of the nova.context.
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/auth.py4
-rw-r--r--nova/api/openstack/views/addresses.py2
-rw-r--r--nova/api/openstack/views/flavors.py2
-rw-r--r--nova/api/openstack/views/images.py2
-rw-r--r--nova/api/openstack/views/servers.py2
5 files changed, 6 insertions, 6 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py
index e33a9faf5..c820a5963 100644
--- a/nova/api/openstack/auth.py
+++ b/nova/api/openstack/auth.py
@@ -68,9 +68,9 @@ class AuthMiddleware(wsgi.Middleware):
not self.auth.is_project_member(user, account):
return faults.Fault(webob.exc.HTTPUnauthorized())
+ req.environ['nova.context'] = context.RequestContext(user, account)
version = req.path.split('/')[1].replace('v', '')
- req.environ['nova.context'] = context.RequestContext(user, account,
- version=version)
+ req.environ['version'] = version
return self.application
def has_authentication(self, req):
diff --git a/nova/api/openstack/views/addresses.py b/nova/api/openstack/views/addresses.py
index d764e5229..65c24dbd7 100644
--- a/nova/api/openstack/views/addresses.py
+++ b/nova/api/openstack/views/addresses.py
@@ -8,7 +8,7 @@ def get_view_builder(req):
A factory method that returns the correct builder based on the version of
the api requested.
'''
- version = req.environ['nova.context'].version
+ version = req.environ['version']
if version == '1.1':
return ViewBuilder_1_1()
else:
diff --git a/nova/api/openstack/views/flavors.py b/nova/api/openstack/views/flavors.py
index dfcc2644c..f945f9f8f 100644
--- a/nova/api/openstack/views/flavors.py
+++ b/nova/api/openstack/views/flavors.py
@@ -5,7 +5,7 @@ def get_view_builder(req):
A factory method that returns the correct builder based on the version of
the api requested.
'''
- version = req.environ['nova.context'].version
+ version = req.environ['version']
base_url = req.application_url
if version == '1.1':
return ViewBuilder_1_1(base_url)
diff --git a/nova/api/openstack/views/images.py b/nova/api/openstack/views/images.py
index cd61ed656..a59d4a557 100644
--- a/nova/api/openstack/views/images.py
+++ b/nova/api/openstack/views/images.py
@@ -5,7 +5,7 @@ def get_view_builder(req):
A factory method that returns the correct builder based on the version of
the api requested.
'''
- version = req.environ['nova.context'].version
+ version = req.environ['version']
base_url = req.application_url
if version == '1.1':
return ViewBuilder_1_1(base_url)
diff --git a/nova/api/openstack/views/servers.py b/nova/api/openstack/views/servers.py
index 7ca2b2427..2549cc11c 100644
--- a/nova/api/openstack/views/servers.py
+++ b/nova/api/openstack/views/servers.py
@@ -11,7 +11,7 @@ def get_view_builder(req):
A factory method that returns the correct builder based on the version of
the api requested.
'''
- version = req.environ['nova.context'].version
+ version = req.environ['version']
addresses_builder = addresses_view.get_view_builder(req)
if version == '1.1':
flavor_builder = flavors_view.get_view_builder(req)